Snapshot-Equivalent Replay of a Live Table Without Taking a Full Snapshot
DBLog is a change-data-capture (CDC) framework that I built at Netflix. It streams row-level changes from a database to downstream systems and it extracts a table’s existing rows in chunks while the source keeps taking writes. It does so without stopping writes at the source and with the ability to extract rows at any time (not only for an initial bootstrap) over full tables or specific keys. The approach has since been adopted by Debezium and Apache Flink CDC. The original Netflix blog post introduces it and the 2020 paper has further details.
Why a Theory Paper
DBLog has run in production for some time now. The original paper describes how it works informally, but it lacks a precise specification and verification of what DBLog guarantees.
That is exactly what the new paper, A Theoretical Study of DBLog, delivers. It formalizes what DBLog provides and machine-checks every theorem in Isabelle/HOL.
This post is a practitioner-oriented explainer of the core idea that the new paper studies.
Snapshot Equivalence
What DBLog achieves and what we have now formally verified can come across as surprising:
DBLog backfills a live table without ever freezing it, yet the result is indistinguishable from a snapshot taken at a single point in time, though no full snapshot is ever taken.
This is achieved by reading each table in chunks, with no lock, no long read transactions, and no pause on writes. And because writes keep landing while scans occur, chunk 1 and chunk 2 get read at different moments in time, with different data underneath them.
And yet, when we replay what DBLog emits, we get exactly the state the backfilled keys had at a single point in the table’s timeline.
To be clear: when this post says replay, it means a consumer’s work on DBLog’s output, and the theorem is about what a consumer ends up with when it applies that output in order. So DBLog does not store the snapshot-equivalent state itself, the sinks do.
The Primitives and the Rule
We have four primitives:
- A chunk is a primary-key range scan
SELECT ... WHERE id BETWEEN ...read live, no lock. Each row becomes a refresh: “key k was observed to be v, at this position in the log.” - A CDC event is a committed change from the database’s log, carrying the full row after the change or its deletion.
- The frontier
fis one position in that log. A commit-order coordinate (such as LSN/GTID), not wall-clock time. It is the point we are claiming to reproduce and it is sliding forward as the backfill proceeds. - The scope
Kis the set of keys we are backfilling (not the whole table, more about that later).
And one rule: Interleave chunk reads with CDC events in log order. To reconstruct the keys K at f, walk the stream left-to-right and for each key the latest event wins.
This assumes we know the log position of each chunk read, so that every refresh carries it. The original DBLog does not know that position directly. It determines it with a watermark window, discussed in a dedicated section later.
Step 1: A Single Chunk
Consider three account balances: Alice, Bob, Carol. We will backfill all three, so K = {Alice, Bob, Carol}.
Chunk A reads Alice and Bob at log position c1:
Alice = 50
Bob = 100
We set f = c1. Nothing has happened since the read, so Alice and Bob still hold the values we just observed. Replaying the two refreshes → output {Alice: 50, Bob: 100} = the database at c1 for the keys read so far. We have not reached Carol’s chunk yet, so this is not the complete result for K. For now, it just fixes the shape of the claim on the simplest case. Next we slide f forward and study what happens.
Step 2: A Concurrent Write
Suppose a write changes Bob to 120, committed at c2 after chunk A already read it as 100.
Chunk A’s record of Bob is now stale. If the output at f = c2 still said Bob = 100 it would be wrong. The database says 120.
The log repairs this. We slide the frontier forward to f = c2 and DBLog’s stream now carries that write:
refresh Bob = 100 (chunk A, at c1)
CDC Bob = 120 (the write at c2)
Replay, latest-event-wins: Bob’s refresh is overwritten by the later CDC event. Bob is now 120, its value at f, not the 100 we read. The stale 100 doesn’t survive the replay because the log repaired it.
A chunk read records a key’s value at the moment it was read and the change log corrects it if needed. Staleness isn’t an error to avoid, it is the normal case, and latest-event-wins repairs it.
Step 3: A Second Chunk
Carol’s row was created earlier (an insert before c3) and read by a different chunk later. Chunk B reads Carol at c3: Carol = 25. Then Carol changes to 35, committed at c4.
Note that chunk A read Alice and Bob at c1, chunk B read Carol at c3. There is no single moment when all three were read. The reads are genuinely scattered across the log.
We slide the frontier to f = c4 and replay the whole stream, latest-event-wins. Carol heals exactly the way Bob did: refresh 25 at c3, CDC 35 at c4, latest wins. Alice was read once and never touched again, so the read is already the value at f, latest-event-wins just keeps it.
Alice = 50 (read once, never changed)
Bob = 120 (stale read repaired)
Carol = 35 (stale read repaired)
Output on K: {Alice: 50, Bob: 120, Carol: 35}, exactly the database’s state at f = c4 on the three keys.
They match, including the two keys whose reads were stale. The reads were scattered across c1 and c3, though the result is pinned to the single frontier c4.
Local Reads, Global Frontier
The distinction to keep, because it is the whole idea:
- The read coordinate is local to each chunk, and therefore to its keys. Alice and Bob at
c1, Carol atc3. Genuinely different read times. - The cut point
fis global, one frontier for all ofK. Every key’s output is its value at that samef. - The change log is the bridge between them. Why does latest-event-wins land on
fexactly ? There are only two cases. If a key changed after its read, the last commit at or beforefdetermines its value atf. If the key did not change, the refresh is still right atf. So the log carries every key from wherever it happened to be read up to the one sharedf.
The reads happened at different log positions, the output stands at a single one. That is what snapshot-equivalence means: the same result we’d get by freezing the database at f and dumping these keys.
Advancing the Frontier
So far this is one cut at one frontier. DBLog doesn’t stop there.
The chunk loop’s job is to bootstrap the first complete cut. When the last chunk closes and CDC is complete through the chosen frontier f, we have a snapshot-equivalent result for all of K at f. After that, DBLog does not re-read a chunk (unless instructed to do so by an operator). It keeps appending CDC events, and every commit it has fully applied advances the cut to a later frontier: f → f' → f''. DBLog’s ongoing output is a sequence of snapshot-equivalent cuts at advancing frontiers, each the previous one plus the log’s faithful change data.
Deletes follow the same rule: “absent” is just another state the latest event can leave behind. A delete after a read wins over the refresh. The key ends absent and that still matches the database at f.
The Watermark Bracket
Where does a chunk’s log position come from?
The original DBLog does not know at which log position its SELECT ran, so it brackets the read. It writes a low watermark before the read and a high watermark after it. The watermarks are then observed in the log and it drops every chunk row whose key has a log event between the two watermarks. Surviving rows are then emitted right after the high watermark.
That emission point is the position we assign to the chunk. A surviving row’s key had no write inside the bracket, so its value is the same at every position in it, including the high watermark. Booking every surviving row at the high watermark is therefore truthful. In the example, c1 is chunk A’s high watermark.
What about the dropped rows ? The paper shows that dropping them is the “one rule” in disguise. Take a row whose key was written inside the bracket, and look at the last such write. If the scan read the row before it, the row is stale and that write wins under the rule anyway. If the scan read it after, the row already carries its value. Either way the log alone gives the right answer, so DBLog drops the row rather than guess which case it is in.
In Step 2, Bob’s write committed after chunk A’s bracket had closed. Had it landed inside the bracket, the original DBLog would have dropped Bob’s row from the chunk and the write alone would carry Bob, with the same result.
So does all of this hold for the original DBLog algorithm with windowing ? The answer is yes. The theorem is about a stream where every refresh carries a position at which its value is right. The windowed output is such a stream because a surviving row is right at the high watermark and a dropped key is carried by the log.
What Is Guaranteed
To be precise about what this theorem guarantees, the boundaries must be clear:
- We are backfilling keys that are in scope, not a whole-table transactional snapshot. (Whole-table is a separate, harder result.)
- It does not claim all the reads happened at one moment. They didn’t. The equivalence is about the output, despite the scattered reads.
- The frontier moves forward: we reproduce a point our scan reaches, not an arbitrary instant in the past.
- It says nothing about the sink. Whether a particular sink applies the stream faithfully is a separate contract that is out of scope.
The formal equality holds under four explicit conditions:
- the chunks partition
K, so every in-scope key belongs to exactly one chunk - every key in
Kgets a refresh from its chunk, recording the key’s value or absence at that chunk’s log position - every read position is at or before
f - the log faithfully carries every change to each key between its read and
f, in commit order
That “one log position” requirement applies to each chunk separately, not to the whole table. The watermark bracket locates the read in the log, but it does not by itself make the rows agree on one position, because a multi-row scan is not instantaneous. The requirement can be met either by reading the chunk from one consistent point-in-time view, such as a statement snapshot or a repeatable-read snapshot taken after the low watermark, or by providing enough per-row evidence to establish what each row contained at the claimed log position. The paper assumes that single position and proves everything above it. It does not model the watermark protocol itself. The table remains live: writers keep running and no long-lived table lock is needed.
Under those conditions the equality is exact:
replay output ↾ K = database state at f ↾ K
We replay what DBLog emitted and look only at our scope keys. We get exactly the database’s state at the single frontier f on those same keys. (In the paper: apply(prefix(R)) ↾ K = src(b₀, H, f) ↾ K.) That is the core result, machine-checked in Isabelle/HOL.
The Virtual Cut
Reads occur at different local times, but the change log lifts each key to a shared global cut. Writes are never paused and nothing is frozen. And yet, the output reflects a single consistent point on the database log. That is snapshot-equivalence.
In the paper (arXiv:2605.31475), we name this construct a virtual cut and it is a property of the output stream DBLog emits.
This is the core idea of the paper.