Commit 8fd842f
committed
fix(client): make Windows fsyncDir0 best-effort for directory handles
FlushFileBuffers is documented for file/volume handles; on NTFS it refuses
a directory handle, commonly returning ERROR_ACCESS_DENIED (or
ERROR_INVALID_FUNCTION on filesystems that do not implement it), and a
GENERIC_WRITE open of a directory can itself be refused by ACLs. Because
fsyncDir0 failures are fatal to their callers -- SfManifest.create,
SlotLock.acquire (reached whenever sf_sync_interval_millis > 0), and the
SegmentManager hot-spare/trim barriers -- SF disk mode with
sf_durability=periodic could hard-fail to start on Windows, a Windows-only
regression on the durability path.
Treat the documented "directory cannot be flushed" signatures
(ERROR_ACCESS_DENIED, ERROR_INVALID_FUNCTION), and an ACL-refused
GENERIC_WRITE open, as best-effort success: create/rename/unlink of
directory entries are made crash consistent by NTFS metadata journaling
($LogFile). This mirrors libgit2/PostgreSQL/SQLite, which do not rely on
directory fsync on Windows. Genuine I/O errors, and a missing directory,
still propagate as fatal. File-data fsync (Files_fsync) is unchanged.1 parent 0c81ad3 commit 8fd842f
1 file changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
235 | 246 | | |
236 | 247 | | |
237 | 248 | | |
238 | | - | |
| 249 | + | |
239 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
240 | 265 | | |
241 | 266 | | |
242 | 267 | | |
| |||
0 commit comments