You also have to fsync the directory
Why a new file is not durable until its directory is, and the crash test that proved it.
NOTE · PLAIN TEXT
Why a new file is not durable until its directory is, and the crash test that proved it.
Why a new file is not durable until its directory is, and the crash test that proved it.
Creating a file writes two things: the file’s data and an entry in its directory. fsync on the file makes the first durable. It says nothing about the second.
The bug
tidewater rotated segments, fsynced the new file and started appending. After a power cut, the file existed but the directory had never been synced, so recovery never found it.
The fix and the test
Sync the directory after creating the file and before the first append. Then cut power at that exact point 40,000 times a night to make sure it stays fixed.
One note a month. No tracking pixels.
New research notes by email, plain text, with a one-click unsubscribe.
Keep reading.
Short write-ups of things that broke and how they got fixed. Plain language, real numbers.
The projects behind the notes.
Filter by language, sort any column, and hover a row for the preview. Each row opens the full case study.