diff --git a/crates/storage/nippy-jar/src/lib.rs b/crates/storage/nippy-jar/src/lib.rs index 2f7a411ab7..20c06c5a88 100644 --- a/crates/storage/nippy-jar/src/lib.rs +++ b/crates/storage/nippy-jar/src/lib.rs @@ -21,6 +21,11 @@ use std::{ ops::Range, path::{Path, PathBuf}, }; + +// Windows specific extension for std::fs +#[cfg(windows)] +use std::os::windows::prelude::OpenOptionsExt; + use tracing::*; pub mod compression; @@ -261,6 +266,16 @@ impl NippyJar { // fsync() dir if let Some(parent) = tmp_path.parent() { + //custom_flags() is only available on Windows + #[cfg(windows)] + OpenOptions::new() + .read(true) + .write(true) + .custom_flags(0x02000000) // FILE_FLAG_BACKUP_SEMANTICS + .open(parent)? + .sync_all()?; + + #[cfg(not(windows))] OpenOptions::new().read(true).open(parent)?.sync_all()?; } Ok(())