mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-17 21:20:37 +00:00
par_fsync - use VirtualFile
This commit is contained in:
committed by
Patrick Insinger
parent
24c8dab86f
commit
191d9d2b74
@@ -1,12 +1,13 @@
|
||||
use std::{
|
||||
fs::File,
|
||||
io,
|
||||
path::{Path, PathBuf},
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
};
|
||||
|
||||
use crate::virtual_file::VirtualFile;
|
||||
|
||||
fn fsync_path(path: &Path) -> io::Result<()> {
|
||||
let file = File::open(path)?;
|
||||
let file = VirtualFile::open(path)?;
|
||||
file.sync_all()
|
||||
}
|
||||
|
||||
@@ -31,7 +32,6 @@ pub fn par_fsync(paths: &[PathBuf]) -> io::Result<()> {
|
||||
/// Increasing this limit will
|
||||
/// - use more memory
|
||||
/// - increase the cost of spawn/join latency
|
||||
/// - increase the peak # of file descriptors
|
||||
const MAX_NUM_THREADS: usize = 64;
|
||||
let num_threads = paths.len().min(MAX_NUM_THREADS);
|
||||
let next_path_idx = AtomicUsize::new(0);
|
||||
|
||||
Reference in New Issue
Block a user