The Invariants I Didn't Hold
An honest accounting of a write-ahead log: what it guarantees, where the documentation outran the code, and the pattern in every gap.
10 posts
An honest accounting of a write-ahead log: what it guarantees, where the documentation outran the code, and the pattern in every gap.
You can't unit test a power cut. What I built instead, and the gap I left in the middle of it.
A 2.55x speedup that was real, produced by a mechanism that doesn't exist, hiding a bug that resurrects deleted keys.
Recovery isn't about salvaging as much as possible. It's about knowing exactly where you stopped believing the file.
Splitting the log into files makes almost everything easier. The seam between writing and rotating is where a durability bug was hiding.
A bounded queue forces you to decide who waits. Cancellation forces you to decide what an error means.
Getting from 255 writes a second to nearly ten thousand, without weakening a single durability guarantee.
The LSN is the identity of every record in the log. It isn't stored on disk, and three problems follow from that.
A length prefix tells you where a record ends. A checksum tells you whether to believe the length prefix.
The durability primitive underneath every database, and the one number that shapes every decision in it.