A write-ahead log that survives the power cord
A crash-safe write-ahead log for embedded databases. Group commit, safe segment rotation and one-pass recovery.

README.md · CASE STUDY
A crash-safe write-ahead log for embedded databases. Group commit, safe segment rotation and one-pass recovery.
A crash-safe write-ahead log for embedded databases. Group commit, safe segment rotation and one-pass recovery.
Embedded databases have two bad options: fsync every write and crawl, or batch writes and hope the machine stays on. I wanted a log that was fast by default and boring after a crash.
What was broken
The first version rotated segments without syncing the directory. A power cut in the few milliseconds after a rotation could leave a segment that existed on disk but not in the directory listing, so recovery never saw it.
What I built
Group commit collects concurrent writers behind a ticket lock and wakes all of them on one fsync. Rotation seals the old segment, creates the next one and syncs the directory before the first append. Recovery scans headers first and replays in a second pass, so an 8 GB log comes back in 3.4 seconds.
How I know it works
A crash simulator cuts power at random points in 40,000 runs a night. Zero lost acknowledged writes since v2.0. The benchmarks run on every pull request and fail the build on a 5% regression.
More projects.
Every project opens the same way: problem, fix, numbers.
Notes from the work.
Short write-ups of things that broke and how they got fixed. Plain language, real numbers.