jonnify·persistence /echo-persistence/replay-and-recovery/one-log-three-replays

Module 6 · Dive 6.1

One log, three replays.

Put three cursors on the same commit log: a booting process at the last snapshot, a replica at its own LSN, a feed subscriber at its cursor. Advancing any of them runs the identical step — apply(commit) — one LSN at a time toward the head. Different starts, one operation. Advance them and watch.

§1

Same step, different starts

interactive
Three cursors, one fold. The log runs LSN 1–10. Each lane is a consumer replaying forward; advancing applies the next commit and lights the shared apply step. Catch all three to the head.
apply(commit) → state
readout · Advance any lane. Each applies one commit and moves one LSN closer to the head — the same fold step lights up regardless of which cursor moved. Boot starts furthest back, the feed nearest the head.
§2

Why one mechanism is enough

graft.design.md

Collapsing three features into one fold is not a tidy diagram — it is the reason the engine is small. There is a single, well-tested replay path; boot, catch-up, and the feed are call sites that hand it a starting LSN. Determinism does the rest: the same commits applied in the same order reach the same state, so a replica that replays the primary’s log is the primary, and a feed subscriber sees exactly what a recovering process would. The next two dives are just this fold with the starting LSN and byte source pinned down — green boot from the local snapshot, replica catch-up from remote segments.

§3

References & sources