jonnify·persistence /echo-persistence/persistence-concepts/volume-lsn-snapshot

Module 3 · Dive 3.1

Volume, LSN, snapshot.

A Volume is an append-only log; each commit gets the next LSN. So “the state at LSN k” is just the log folded up to k — and a snapshot is a read at an LSN, nothing more. Because nothing is ever overwritten in place, every past point is still readable. Scrub the ribbon and read any of them.

§1

A read at an LSN

interactive
The LSN ribbon. Each cell is a commit, in order, with the key it set. Drag the read point: commits up to it are visible; later ones are invisible to this reader; the folded state is shown below.
read @ LSN 8 state @ read point (latest value per key):
readout · Drag the read point. The snapshot at LSN k is the log folded to k; commits after k are simply not in this reader’s view. No copy, no lock — the past is still there.
§2

Why time travel is free

graft.design.md

Append-only is the whole trick. A reader holding LSN k sees a fixed prefix of the log no matter how many commits land after, so reads need no lock and snapshots need no copy — the same property the persistent structure gave Champ in Module 2, now at the log level. It is also what makes a replica’s “catch up to LSN k” and the change feed’s “everything after LSN k” well-defined. The one hard part is appending the next LSN when two writers want it at once — the next two dives.

§3

References & sources