mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-23 06:09:59 +00:00
Patch error with hole punching LFC
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
//! process. The backend processes *also* read the file (and sometimes also
|
//! process. The backend processes *also* read the file (and sometimes also
|
||||||
//! write it? ), but the backends use direct C library calls for that.
|
//! write it? ), but the backends use direct C library calls for that.
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::os::linux::fs::MetadataExt;
|
|
||||||
use std::os::unix::fs::FileExt;
|
use std::os::unix::fs::FileExt;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -179,7 +178,7 @@ impl FileCache {
|
|||||||
nix::FallocateFlags::FALLOC_FL_ZERO_RANGE
|
nix::FallocateFlags::FALLOC_FL_ZERO_RANGE
|
||||||
.union(nix::FallocateFlags::FALLOC_FL_KEEP_SIZE),
|
.union(nix::FallocateFlags::FALLOC_FL_KEEP_SIZE),
|
||||||
(block as usize * BLCKSZ) as libc::off_t,
|
(block as usize * BLCKSZ) as libc::off_t,
|
||||||
1
|
BLCKSZ as libc::off_t
|
||||||
) {
|
) {
|
||||||
tracing::error!("failed to un-punch hole in LFC at {block}: {e}");
|
tracing::error!("failed to un-punch hole in LFC at {block}: {e}");
|
||||||
return;
|
return;
|
||||||
@@ -238,7 +237,7 @@ impl FileCache {
|
|||||||
/// of holes within a file. Whether we need this function at all is unclear,
|
/// of holes within a file. Whether we need this function at all is unclear,
|
||||||
/// as seemingly this part of the codebase only targets a system with ext4?
|
/// as seemingly this part of the codebase only targets a system with ext4?
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub fn undelete_blocks(&self, num_blocks: u64) -> u64 {
|
pub fn unpunch_blocks(&self, num_blocks: u64) -> u64 {
|
||||||
use nix::unistd as nix;
|
use nix::unistd as nix;
|
||||||
let mut free_list = self.free_list.lock().unwrap();
|
let mut free_list = self.free_list.lock().unwrap();
|
||||||
let num_bytes = (free_list.next_free_block * BLOCKSZ) as i64;
|
let num_bytes = (free_list.next_free_block * BLOCKSZ) as i64;
|
||||||
|
|||||||
@@ -798,7 +798,7 @@ impl<'t> IntegratedCacheWriteAccess<'t> {
|
|||||||
err
|
err
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let remaining = file_cache.undelete_blocks(difference as u64);
|
let remaining = file_cache.unpunch_blocks(difference as u64);
|
||||||
file_cache.grow(remaining as u64);
|
file_cache.grow(remaining as u64);
|
||||||
debug_assert!(file_cache.free_space() > remaining);
|
debug_assert!(file_cache.free_space() > remaining);
|
||||||
} else if old_num_blocks > num_blocks {
|
} else if old_num_blocks > num_blocks {
|
||||||
@@ -832,7 +832,7 @@ impl<'t> IntegratedCacheWriteAccess<'t> {
|
|||||||
.fetch_max(old_val.lw_lsn.into_inner().0, Ordering::Relaxed);
|
.fetch_max(old_val.lw_lsn.into_inner().0, Ordering::Relaxed);
|
||||||
let cache_block = old_val.cache_block.into_inner();
|
let cache_block = old_val.cache_block.into_inner();
|
||||||
if cache_block != INVALID_CACHE_BLOCK {
|
if cache_block != INVALID_CACHE_BLOCK {
|
||||||
file_cache.delete_block(cache_block);
|
file_cache.punch_block(cache_block);
|
||||||
file_evictions += 1;
|
file_evictions += 1;
|
||||||
self.metrics.cache_page_evictions_counter.inc();
|
self.metrics.cache_page_evictions_counter.inc();
|
||||||
}
|
}
|
||||||
@@ -850,7 +850,7 @@ impl<'t> IntegratedCacheWriteAccess<'t> {
|
|||||||
while remaining > 0 as u64 {
|
while remaining > 0 as u64 {
|
||||||
if let Some(i) = self.try_evict_cache_block() {
|
if let Some(i) = self.try_evict_cache_block() {
|
||||||
if i != INVALID_CACHE_BLOCK {
|
if i != INVALID_CACHE_BLOCK {
|
||||||
file_cache.delete_block(i);
|
file_cache.punch_block(i);
|
||||||
remaining -= 1;
|
remaining -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ where
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// tracing::info!("waiting for conflicting IO {request_id} to complete");
|
tracing::info!("waiting for conflicting IO {request_id} to complete");
|
||||||
let _ = lock.lock().await;
|
let _ = lock.lock().await;
|
||||||
// tracing::info!("conflicting IO {request_id} completed");
|
tracing::info!("conflicting IO {request_id} completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
MutexHashMapGuard {
|
MutexHashMapGuard {
|
||||||
|
|||||||
Reference in New Issue
Block a user