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