Module 9 · Dive 9.3
Log-head recovery.
A fresh node with nothing on disk doesn’t download a database to come up. It reads the head object from the bucket to learn where the log ends, reads the commit chain and snapshot pointer to fix its position, and is then ready to serve — with zero pages loaded. Pages arrive lazily, faulted from segments only when something asks for them. Step the recovery, then fault a few pages.
Read the head, fault the rest
interactivehead object (LSN 8), then the commit chain and snapshot pointer, and becomes ready — still 0 pages loaded. Then fault pages one at a time from segments.Why a cold node is ready in two reads { id="why" }
graft.design.mdThe expensive thing in recovery is data; the cheap thing is knowing where you are. Log-head recovery separates them. To be correct, a node only needs the head — the latest commit object — and the snapshot pointer it descends from; both are tiny objects, so two reads make the node authoritative about the log’s end. It can then accept reads immediately, because a page it doesn’t hold is just a fault: find the segment that carries that page’s latest version (the rollup from Dive 9.1), fetch it, serve it, and keep it cached (the lazy Reader from Module 7). Nothing forces a full download — a node that only ever touches a hot working set only ever fetches that working set. This is what makes the remote a true floor rather than a backup: a brand-new replica, a restarted process, or a promoted standby all come up the same way, in two reads, and warm themselves on demand. It is the same fold the whole of Module 6 described, with its starting point — the head — read from the shared bucket. Chapter III is complete: one contract, two engines, one remote. Chapter IV turns to the platform around them.
References & sources
- Echo records
- graft specs / graft.2.mdeg.2 — recovery from the remote log head
- graft.roadmap.mdeg.2 — recovery from the remote log head
- graft.design.mdlog-head recovery, lazy page faults
- store.design.mdhead + snapshot pointer, fault-on-read
- External
- orbitinghail/graftcheckout-at-LSN, lazy fetch
- Demand pagingload pages only when referenced
- Object storagethe durable head and segments