Module 5 · Chapter II — The local store
MVCC & time travel.
Module 4 left us with one fact: old roots stay valid. Multiversion concurrency control is what you get for free from it. A snapshot is a retained root, so readers never lock and never block the writer, and “the state at any past LSN” is just the root that was current then. Three facets of one idea — tap each.
One fact, three payoffs
graft.design.mdBecause an update keeps the old root (Module 4), many versions exist at once over a single, shared, immutable node pool — that is coexisting versions. A reader grabs the current root and reads it to completion no matter what the writer does next, and the writer appends new roots without waiting on any reader — that is lock-free concurrency, readers and a writer with no mutual blocking. And since each LSN named a root, you can open the root that was current at any LSN — that is time travel, the checkout-at-LSN the change feed and replicas depend on. Each is a dive.
The three dives
module 5Coexisting versions
Many roots, one node pool. Click a version and watch which nodes it reaches — mostly shared, a few its own. A snapshot is just a root.
Dive 5.2Lock-free readers
Start a reader, then let the writer commit. The reader keeps reading its pinned version, unbothered — no reader blocks the writer, no writer blocks a reader.
Dive 5.3Checkout & GC
Open the Volume at any past LSN with a scrubber; then run garbage collection and watch old roots reclaimed — except the one a reader has pinned.
Build & check
One sentence each linking the three facets back to Module 4’s “old roots stay valid”: why coexistence is automatic, why reads need no lock, and why checkout-at-LSN is well-defined. No numbers — the chain of reasoning is the deliverable.
Answer without code: what exactly is a snapshot, in one phrase; and what is the single thing GC must never reclaim? If you said “a retained root” and “a root a reader still pins,” you have the module.
References & sources
- External
- Multiversion concurrency controlreaders and writers, no locks
- CubDB.Snapshota snapshot as a retained version
- orbitinghail/graftcheckout-at-LSN, the change feed
- Echo records
- graft.design.mdMVCC, checkout-at-LSN, delta snapshots
- store.design.mdsnapshots and retention on CubDB