Skip to content

Commit c3dda2b

Browse files
committed
fix(storage): sync manifest copy via write handle
StorageManifest::copy_to synced the copied manifest through a read-only File::open handle. On Windows FlushFileBuffers requires GENERIC_WRITE, so every Raft snapshot checkpoint failed deterministically with ERROR_ACCESS_DENIED (surfaced as snapshot_gate_tests IO errors in the windows-latest CI job). Match the copy_dir_all pattern in checkpoint.rs and sync through OpenOptions::new().write(true).
1 parent 945e7ed commit c3dda2b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/storage/src/storage_manifest.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
//! mechanism (or the file was lost); opening then fails instead of silently
3737
//! reinterpreting existing data.
3838
39-
use std::fs;
39+
use std::fs::{self, OpenOptions};
4040
use std::io::Write;
4141
use std::path::{Path, PathBuf};
4242
use std::sync::Mutex;
@@ -127,7 +127,9 @@ impl StorageManifest {
127127
for attempt in 0..5 {
128128
match (|| -> std::io::Result<()> {
129129
fs::copy(&self.path, &target)?;
130-
fs::File::open(&target)?.sync_all()?;
130+
// Sync via a write handle: FlushFileBuffers on Windows
131+
// requires GENERIC_WRITE, so a read-only File::open fails.
132+
OpenOptions::new().write(true).open(&target)?.sync_all()?;
131133
Ok(())
132134
})() {
133135
Ok(()) => return Ok(()),

0 commit comments

Comments
 (0)