<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Andreas Andreakis</title><description>Andreas Andreakis: Engineer and researcher in databases, Change-Data-Capture (CDC), and distributed systems. Creator of DBLog.</description><link>https://aandreakis.com</link><language>en-us</language><item><title>Evolving from Pure CDC to Full Data Synchronization with DBLog-Based Incremental Snapshots</title><link>https://aandreakis.com/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots</link><guid isPermaLink="true">https://aandreakis.com/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots</guid><description>How extending DBLog incremental snapshots to emit key absence at high watermarks removes orphan rows for full CDC synchronization.</description><pubDate>Tue, 10 Nov 2026 09:08:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://aandreakis.com/dblog&quot;&gt;DBLog&lt;/a&gt; was introduced at Netflix &lt;a href=&quot;https://netflixtechblog.com/dblog-a-generic-change-data-capture-framework-69351fb9099b&quot;&gt;in 2019&lt;/a&gt; to capture both the live transaction log and the full state of a source database in a single, ordered stream without stalling writes or the log event propagation. That design became the foundation for incremental snapshots in &lt;a href=&quot;https://debezium.io/blog/2021/10/07/incremental-snapshots/&quot;&gt;Debezium&lt;/a&gt; and &lt;a href=&quot;https://nightlies.apache.org/flink/flink-cdc-docs-stable/docs/connectors/flink-sources/mysql-cdc/&quot;&gt;Apache Flink CDC&lt;/a&gt; and in a &lt;a href=&quot;https://arxiv.org/abs/2609.08160&quot;&gt;previous work&lt;/a&gt; we showed that they are all part of the same family.&lt;/p&gt;
&lt;p&gt;Beyond capturing full tables, the original DBLog approach also allows repairing specific entries in place. However, because it only emits rows that exist at the source, this is limited to fixing missing rows or updating their values, while deleting &lt;strong&gt;orphan rows&lt;/strong&gt; (rows that sit in a downstream sink even though they do not exist at the source) is not supported.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots/00-repairs-without-orphans.png&quot; width=&quot;2400&quot; height=&quot;557&quot; alt=&quot;A source database with an orders table and its transaction log, a CDC connector that streams the log and re-reads the table in chunks, and a sink. A repair pass overwrites the outdated value of order 2 and restores the missing order 3, but order 4, which no longer exists at the source, stays in the sink.&quot; loading=&quot;eager&quot; fetchpriority=&quot;high&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 1: A minimal CDC pipeline. The connector streams the source&apos;s transaction log and re-reads the orders table in chunks. A repair pass overwrites the outdated value of order 2 and restores the missing order 3, but order 4, which no longer exists at the source, stays in the sink.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In our new paper, &lt;a href=&quot;https://arxiv.org/abs/2611.10810&quot;&gt;&lt;em&gt;Extending DBLog-Based Incremental Snapshots to Handle Orphan Rows in CDC Pipelines&lt;/em&gt;&lt;/a&gt;, we solve this problem by extending the DBLog design so that a pipeline can also detect and remove orphan rows. With this addition, a CDC pipeline that is using DBLog-style incremental snapshots becomes a complete data synchronization engine whether a sink catches up on live changes or missing rows (empty sink or lost inserts), holds wrong column values (corrupted data or lost updates), or contains rows it should not have (orphan rows).&lt;/p&gt;
&lt;p&gt;This post explains the core idea for practitioners, which applies to Debezium, to Apache Flink CDC with a small adaptation and to any connector built on DBLog-based incremental snapshots: why CDC naturally evolves towards full data synchronization, why orphan rows are the missing piece when keeping populated sinks in sync and how to remove them safely through the stream while live changes keep flowing.&lt;/p&gt;
&lt;h2 id=&quot;three-steps-from-pure-cdc-to-full-data-synchronization&quot;&gt;Three Steps from Pure CDC to Full Data Synchronization&lt;/h2&gt;
&lt;p&gt;If you look at how teams use CDC in production, the role of the pipeline is evolving across three steps. Solving each step addressed an operational limitation of the previous one and opened the door to the next.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 1: Pure CDC.&lt;/strong&gt; Early CDC connectors read committed &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt; records from the database transaction log and put them on a stream. For event-driven microservices and audit logs, streaming those change events was enough. However, most deployments use CDC to maintain a derived copy of a source database in one or more sinks, such as a search index, a cache, a read replica or a data warehouse. Transaction logs are retained only for a limited time or size, so log tailing alone cannot populate a new sink.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2: Source state capture.&lt;/strong&gt; To also capture existing rows, connectors such as Debezium first used one-time initial snapshots at startup, which pause log propagation until the full scan finishes and reaches the sink and may briefly lock tables. Adopting the DBLog design as incremental snapshots in Debezium and Flink CDC broke scans into small chunks interleaved with the live log, enabling a continuous flow of both snapshots and live changes as well as on-demand repairs that refresh specific keys or tables in place.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3: Full data synchronization.&lt;/strong&gt; That ability to refresh keys in place against an already populated sink leads to the next step: full data synchronization, whose goal is to continuously converge a sink towards the source no matter how the sink lags or has drifted. This covers a lagging sink catching up on live &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt; events as they occur at the source, closing gaps of missing rows via source &lt;code&gt;SELECT&lt;/code&gt; capture (such as pre-existing rows when bootstrapping an empty sink) and repairing drift when a sink has dropped events along the way, applied wrong column values, or accumulated extra entries from another writer.&lt;/p&gt;
&lt;p&gt;This evolution happens across three dimensions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What the pipeline reconciles (scope):&lt;/strong&gt; from streaming live change events, to capturing present table state, to full synchronization that covers missing rows, wrong column values and orphan rows.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;When state capture runs (lifecycle):&lt;/strong&gt; from a one-time full bootstrap of an empty sink at startup, to on-demand and periodic repairs that refresh specific keys or tables in place.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;How it runs alongside live traffic (continuity):&lt;/strong&gt; from stopping source writes or pausing log propagation during a snapshot scan, to a continuous flow of both live changes and state capture on the same stream.&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots/01-from-change-capture-to-full-sync.png&quot; width=&quot;2400&quot; height=&quot;1265&quot; alt=&quot;Three steps. Step 1 emits change events from the log, so a sink follows live changes. Step 2 adds chunk rows interleaved with the log, so a sink can be bootstrapped and repaired in place for missing rows and wrong values. Step 3 adds the keys a chunk read found absent, so orphan rows are removed too. Steps 1 and 2 are where CDC is today. Step 3 is the next step.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 2: Each step adds one kind of output. Change capture streams the log. Source state capture adds chunk rows, which bootstrap a sink and repair it in place. Orphans are the one case it misses, since a chunk read emits only the rows it finds. Full synchronization adds the keys a chunk read found absent, so orphan rows are removed too.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;That shift from populating an empty sink to repairing a populated sink is where &lt;strong&gt;orphan rows&lt;/strong&gt; appear.&lt;/p&gt;
&lt;p&gt;When you stream a snapshot into an empty sink, emitting only the rows currently present at the source is enough because any key the snapshot never mentions is absent by construction. When you re-run an incremental snapshot against an already populated sink, emitting present rows fills in missing rows and overwrites wrong column values, because each chunk emits the latest state of every row that exists. However, if the sink holds a row whose key does not exist at the source, the chunk &lt;code&gt;SELECT&lt;/code&gt; does not return that key. Nothing is emitted for it and the extra row stays in the sink forever.&lt;/p&gt;
&lt;h2 id=&quot;how-orphan-rows-arise-and-what-a-chunk-read-already-knows&quot;&gt;How Orphan Rows Arise and What a Chunk Read Already Knows&lt;/h2&gt;
&lt;p&gt;Orphan rows show up in populated sinks for a handful of recurring operational reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Source log gaps and failovers.&lt;/strong&gt; A connector falls behind a MySQL binlog purge, a PostgreSQL WAL segment cleanup or an unpromoted replica failover. Any &lt;code&gt;DELETE&lt;/code&gt; that committed during that gap never reaches the stream.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Source point-in-time recovery.&lt;/strong&gt; When a source database is restored to an earlier backup after an incident, rows inserted after the backup timestamp cease to exist at the source without producing &lt;code&gt;DELETE&lt;/code&gt; records in the log.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Downstream pipeline filtering or delivery bugs.&lt;/strong&gt; A bug in a stream processor, a schema filter change or a dead-lettered batch drops &lt;code&gt;DELETE&lt;/code&gt; events before they reach the sink.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Side writes to the sink.&lt;/strong&gt; A backfill script, manual hotfix or dual-writing service writes a row directly into the sink that was never committed at the source.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take an &lt;code&gt;orders&lt;/code&gt; table with integer primary keys. Suppose keys &lt;code&gt;1&lt;/code&gt; through &lt;code&gt;10&lt;/code&gt; were replicated earlier and orders &lt;code&gt;4&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt; were later deleted at the source during a log gap so the sink still holds all ten rows &lt;code&gt;1..10&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To repair the sink, we run an incremental snapshot pass whose first chunk covers keys up to &lt;code&gt;10&lt;/code&gt;, meaning the half-open key interval &lt;code&gt;(-∞, 10]&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;SELECT pk, customer_id, total, status
FROM orders
WHERE pk &amp;#x3C;= 10
ORDER BY pk
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The watermark table lives in the source database, so writes to it appear in the same transaction log as changes to &lt;code&gt;orders&lt;/code&gt;. A DBLog-style incremental snapshot executes this chunk read alongside the live log as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The connector briefly pauses log processing and writes a low watermark &lt;code&gt;LOW&lt;/code&gt; into the source watermark table.&lt;/li&gt;
&lt;li&gt;It runs the chunk &lt;code&gt;SELECT&lt;/code&gt; for &lt;code&gt;pk &amp;#x3C;= 10&lt;/code&gt;, holding the returned rows in memory. Suppose the query returns eight rows: &lt;code&gt;1, 2, 3, 5, 6, 8, 9&lt;/code&gt; and &lt;code&gt;10&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It writes a high watermark &lt;code&gt;HIGH&lt;/code&gt; into the watermark table, resumes log processing and reads the log up to &lt;code&gt;HIGH&lt;/code&gt;. Suppose order &lt;code&gt;9&lt;/code&gt; is updated in the log between &lt;code&gt;LOW&lt;/code&gt; and &lt;code&gt;HIGH&lt;/code&gt;. The connector emits that live &lt;code&gt;UPDATE 9&lt;/code&gt; event and drops key &lt;code&gt;9&lt;/code&gt; from its buffered chunk rows so the older chunk value cannot overwrite the newer log event.&lt;/li&gt;
&lt;li&gt;When &lt;code&gt;HIGH&lt;/code&gt; arrives in the log, the connector closes the chunk and emits the surviving chunk rows: &lt;code&gt;1, 2, 3, 5, 6, 8&lt;/code&gt; and &lt;code&gt;10&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots/02-what-one-read-knows.png&quot; width=&quot;2400&quot; height=&quot;945&quot; alt=&quot;Between the low and high watermarks the connector selects keys up to 10 while order 9 is updated in the log. The read returns 1, 2, 3, 5, 6, 8, 9 and 10 and proves 4 and 7 are absent, yet existing incremental snapshots emit only the present rows.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 3: A watermark-bracketed chunk read over pk &amp;#x3C;= 10 returns keys 1, 2, 3, 5, 6, 8, 9 and 10 while key 9 is updated inside the window. The read proves that 4 and 7 do not exist in (-∞, 10], yet existing incremental snapshots emit only the present rows and leave 4 and 7 in the sink. Capturing that fact inside the watermark window lets the pipeline remove orphans with the same safety guarantee.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;At &lt;code&gt;HIGH&lt;/code&gt;, the connector already knows more than which rows exist. Because the query scanned the entire range &lt;code&gt;pk &amp;#x3C;= 10&lt;/code&gt; after &lt;code&gt;LOW&lt;/code&gt; and the connector observed every log event between &lt;code&gt;LOW&lt;/code&gt; and &lt;code&gt;HIGH&lt;/code&gt;, the set of keys that exist at the source in &lt;code&gt;(-∞, 10]&lt;/code&gt; at the high watermark is covered by the union of the keys selected by the query (&lt;code&gt;1, 2, 3, 5, 6, 8, 9, 10&lt;/code&gt;) and any keys touched in the window (&lt;code&gt;9&lt;/code&gt;). Every other key in &lt;code&gt;(-∞, 10]&lt;/code&gt;, including &lt;code&gt;4&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt;, is absent at the high watermark, provided the chunk query sees every transaction logged before &lt;code&gt;LOW&lt;/code&gt;. The connector enforces this on PostgreSQL, where a transaction can be logged before a query can see it.&lt;/p&gt;
&lt;p&gt;Existing incremental snapshot implementations discard that negative information because they only emit events for the rows the query returned.&lt;/p&gt;
&lt;h2 id=&quot;why-out-of-band-deletes-race-with-live-data&quot;&gt;Why Out-of-Band Deletes Race with Live Data&lt;/h2&gt;
&lt;p&gt;Before modifying the connector, it is tempting to reach for an external script that queries the source keys, compares them against the sink keys and runs &lt;code&gt;DELETE FROM orders WHERE pk IN (4, 7)&lt;/code&gt; directly on the sink.&lt;/p&gt;
&lt;p&gt;In a quiescent database, that works. On a live table, an out-of-band delete has no position in the replication stream, which opens a classic time-of-check to time-of-use race whenever a key can be re-created or re-inserted (for example, an account re-registration, a composite mapping key, a natural key or an undo operation that restores a deleted order).&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots/03-why-stream-position-matters.png&quot; width=&quot;2400&quot; height=&quot;1498&quot; alt=&quot;Top: When absence is emitted at the high watermark, a later re-insert of order 7 follows the delete in stream order and survives. Bottom: When an external diff job issues an unpositioned delete directly against the sink, it can arrive after the re-insert and delete a live row.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 4: Top: When absence is emitted at HIGH, a later INSERT 7 follows the delete in stream order and the live row survives. Bottom: An external diff job that deletes directly from the sink has no position in the stream, so its delete can land after INSERT 7 and remove a live row.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;As Figure 4 illustrates, suppose order &lt;code&gt;7&lt;/code&gt; is re-inserted at the source shortly after the read:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;In-band at the high watermark (top):&lt;/strong&gt; The absence of &lt;code&gt;7&lt;/code&gt; is emitted at &lt;code&gt;HIGH&lt;/code&gt;, before the log reaches the later &lt;code&gt;INSERT 7&lt;/code&gt;. The sink deletes the stale orphan &lt;code&gt;7&lt;/code&gt; at &lt;code&gt;HIGH&lt;/code&gt; and then applies &lt;code&gt;INSERT 7&lt;/code&gt; from the stream, ending with the new live row.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Out-of-band diff job (bottom):&lt;/strong&gt; The diff job reads the source while &lt;code&gt;7&lt;/code&gt; is absent, then reads the sink and prepares to delete &lt;code&gt;7&lt;/code&gt;. In the meantime, &lt;code&gt;INSERT 7&lt;/code&gt; commits at the source and flows through the CDC stream to the sink. When the diff job’s direct &lt;code&gt;DELETE 7&lt;/code&gt; finally executes against the sink, it deletes the newly created live row and the stream has no later event to bring it back.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The simplest way to delete orphans safely without stopping writes is to anchor the absence of a key at the high watermark of the read that observed it, just like present chunk rows are.&lt;/p&gt;
&lt;h2 id=&quot;extending-incremental-snapshots-three-building-blocks&quot;&gt;Extending Incremental Snapshots: Three Building Blocks&lt;/h2&gt;
&lt;p&gt;In the paper, we extend the DBLog incremental snapshot design with three building blocks: a chunk info record, its per-key rendering as absence events and a repair request that an external drift process can call.&lt;/p&gt;
&lt;h3 id=&quot;building-block-1-chunk-info-records&quot;&gt;Building Block 1: Chunk Info Records&lt;/h3&gt;
&lt;p&gt;The most direct way to express what a chunk read learned is to emit a &lt;strong&gt;chunk info record&lt;/strong&gt; at the high watermark, immediately ahead of the chunk’s surviving row events.&lt;/p&gt;
&lt;p&gt;Because consecutive chunks partition the table’s key space without gaps, the first chunk covers &lt;code&gt;(-∞, u_1]&lt;/code&gt;, each middle chunk covers &lt;code&gt;(l_i, u_i]&lt;/code&gt; where &lt;code&gt;l_i = u_{i-1}&lt;/code&gt; and a tail read &lt;code&gt;WHERE pk &gt; u_n&lt;/code&gt; covers &lt;code&gt;(u_n, +∞)&lt;/code&gt; once it returns fewer rows than the chunk limit (or under heavy inserts, a pass can cap how many tail chunks it runs and stop at the last upper bound it reached). For our first chunk over &lt;code&gt;pk &amp;#x3C;= 10&lt;/code&gt;, the chunk info record looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;table&quot;: &quot;inventory.orders&quot;,
  &quot;read_id&quot;: &quot;snap-01-chunk-01&quot;,
  &quot;range&quot;: {&quot;lower&quot;: {&quot;open&quot;: true},
            &quot;upper&quot;: {&quot;key&quot;: 10, &quot;inclusive&quot;: true}},
  &quot;selected&quot;: [1, 2, 3, 5, 6, 8, 9, 10],
  &quot;changed&quot;: [9]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here &lt;code&gt;selected&lt;/code&gt; lists the keys returned by the chunk &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;changed&lt;/code&gt; lists the keys in &lt;code&gt;range&lt;/code&gt; that had at least one log event between &lt;code&gt;LOW&lt;/code&gt; and &lt;code&gt;HIGH&lt;/code&gt; and &lt;code&gt;read_id&lt;/code&gt; identifies the read. Their union &lt;code&gt;selected ∪ changed&lt;/code&gt; is the exact set of keys in &lt;code&gt;(-∞, 10]&lt;/code&gt; that are protected at the high watermark:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Any key in &lt;code&gt;(-∞, 10]&lt;/code&gt; &lt;strong&gt;outside&lt;/strong&gt; &lt;code&gt;selected ∪ changed&lt;/code&gt; was neither returned by the query nor touched in the window, so it does not exist at the source at &lt;code&gt;HIGH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Any key in &lt;code&gt;changed&lt;/code&gt; (such as &lt;code&gt;9&lt;/code&gt;) already had its live change emitted during the window and must not be deleted.&lt;/li&gt;
&lt;li&gt;Any key in &lt;code&gt;selected \ changed&lt;/code&gt; (&lt;code&gt;1, 2, 3, 5, 6, 8, 10&lt;/code&gt;) is emitted as a surviving chunk row right after the chunk info record.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A sink consumer that applies chunk info records (such as a relational replica or a custom sink service) processes the record in stream order, after every event ahead of it. It deletes every key it holds in &lt;code&gt;range&lt;/code&gt; that is neither selected nor changed and then upserts the surviving chunk rows, in one transaction or separately. In our example, that removes orphans &lt;code&gt;4&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt;, as well as any side-written key below &lt;code&gt;10&lt;/code&gt;, without needing a list of suspect keys.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots/04-two-ways-to-state-absence.png&quot; width=&quot;2400&quot; height=&quot;1430&quot; alt=&quot;The same chunk read of keys up to 10, with order 9 updated inside the window. A: at HIGH the connector emits one chunk info record with the range, the selected keys and the changed keys, then the surviving rows. Every key in the range that is neither selected nor changed is stated absent, which covers 4 and 7. B: the connector checks a list of candidate keys 2, 4, 7, 9 and 12. Key 2 was selected, 9 changed and 12 belongs to a later chunk, so it emits absence events for 4 and 7 only, alongside the surviving rows.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 5: The same chunk read, two ways to state absence at HIGH. A: one chunk info record with the range, the selected keys and the changed keys, emitted ahead of the surviving rows. Every key in the range that is on neither list is absent, which covers 4 and 7. B: per-key absence events for the candidate keys found absent, here 4 and 7, which fit key-partitioned topics such as Kafka.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id=&quot;building-block-2-per-key-absence-events&quot;&gt;Building Block 2: Per-Key Absence Events&lt;/h3&gt;
&lt;p&gt;Many pipelines fan out through key-partitioned logs like Apache Kafka or feed off-the-shelf sink connectors (JDBC, Elasticsearch, OpenSearch or Iceberg) that only act on individual keys and do not execute range deletes. On a compacted Kafka topic, the latest record for a key is removed only when a tombstone (&lt;code&gt;key = k, value = null&lt;/code&gt;) is produced for that exact key &lt;code&gt;k&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To support these pipelines without changing sink connectors beyond enabling delete-on-tombstone, the connector can resolve the chunk’s absence statement into &lt;strong&gt;per-key absence events&lt;/strong&gt; before putting records on the stream. Given a set of candidate keys &lt;code&gt;C&lt;/code&gt; (which the connector can obtain by scanning its own compacted output topic at the start of a pass, or receive from an external caller), the connector filters &lt;code&gt;C&lt;/code&gt; to the current chunk’s range and removes &lt;code&gt;selected ∪ changed&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;AbsentInChunk = (C ∩ range) \ (selected ∪ changed)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Suppose the candidate set is &lt;code&gt;C = {2, 4, 7, 9, 12}&lt;/code&gt;. For our chunk &lt;code&gt;(-∞, 10]&lt;/code&gt;, the keys inside the range are &lt;code&gt;{2, 4, 7, 9}&lt;/code&gt; (while &lt;code&gt;12&lt;/code&gt; waits for a later chunk). Removing &lt;code&gt;selected ∪ changed = {1, 2, 3, 5, 6, 8, 9, 10}&lt;/code&gt; leaves &lt;code&gt;{4, 7}&lt;/code&gt;. At &lt;code&gt;HIGH&lt;/code&gt;, alongside the surviving chunk rows, the connector emits an absence event for keys &lt;code&gt;4&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt;, with the operation type &lt;code&gt;absent&lt;/code&gt;. On Kafka, it is a standard tombstone by default, with this metadata in the message headers:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;op&quot;: &quot;absent&quot;,
  &quot;key&quot;: { &quot;pk&quot;: 4 },
  &quot;source&quot;: { &quot;table&quot;: &quot;inventory.orders&quot;, &quot;read_id&quot;: &quot;snap-01-chunk-01&quot; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sink connectors that delete on tombstones apply these as ordinary deletes for keys &lt;code&gt;4&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt;, once that option is enabled (such as &lt;code&gt;delete.enabled&lt;/code&gt; in the JDBC sinks). For consumers of a CDC envelope that do not know the new type, the connector can map it to &lt;code&gt;delete&lt;/code&gt;. Kafka log compaction then also removes keys &lt;code&gt;4&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt; from the topic itself.&lt;/p&gt;
&lt;h3 id=&quot;building-block-3-the-verify-keys-absent-request-and-external-drift-detection&quot;&gt;Building Block 3: The &lt;code&gt;verify-keys-absent&lt;/code&gt; Request and External Drift Detection&lt;/h3&gt;
&lt;p&gt;What if you already have an external drift detector (such as a warehouse reconciliation query or an index validator) that compares the sink against the source, or what if a backfill script or side writer writes orphan key &lt;code&gt;12&lt;/code&gt; directly into the sink without going through Kafka?&lt;/p&gt;
&lt;p&gt;Suppose the detector flags keys &lt;code&gt;4&lt;/code&gt;, &lt;code&gt;7&lt;/code&gt;, &lt;code&gt;9&lt;/code&gt; and &lt;code&gt;12&lt;/code&gt; at the sink (where &lt;code&gt;4&lt;/code&gt;, &lt;code&gt;7&lt;/code&gt; and &lt;code&gt;12&lt;/code&gt; are genuine orphans, while &lt;code&gt;9&lt;/code&gt; is a live row that looked suspicious only because the detector compared against a slightly stale view of the source). Instead of letting the external detector delete rows from the sink out of band, we add a &lt;code&gt;verify-keys-absent&lt;/code&gt; &lt;strong&gt;repair request&lt;/strong&gt; to the connector’s signaling table:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;id&quot;: &quot;drift-check-01&quot;,
  &quot;type&quot;: &quot;verify-keys-absent&quot;,
  &quot;data&quot;: {
    &quot;data-collections&quot;: [&quot;inventory.orders&quot;],
    &quot;keys&quot;: [4, 7, 9, 12]
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When the connector receives this signal, it runs a lightweight watermark-bracketed cycle specifically for those suspect keys:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It writes &lt;code&gt;LOW&lt;/code&gt; and runs a key-list query &lt;code&gt;SELECT pk FROM orders WHERE pk IN (4, 7, 9, 12)&lt;/code&gt;. It only needs to fetch the primary key column, not the full row payload.&lt;/li&gt;
&lt;li&gt;It writes &lt;code&gt;HIGH&lt;/code&gt; and tracks any log events for &lt;code&gt;{4, 7, 9, 12}&lt;/code&gt; between &lt;code&gt;LOW&lt;/code&gt; and &lt;code&gt;HIGH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;At &lt;code&gt;HIGH&lt;/code&gt;, for every requested key that was neither returned by the &lt;code&gt;SELECT&lt;/code&gt; nor touched in the window, it emits a positioned absence event (a tombstone by default on Kafka) into the stream.&lt;/li&gt;
&lt;/ol&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots/05-verify-keys-absent.png&quot; width=&quot;2400&quot; height=&quot;655&quot; alt=&quot;An external drift process inspects the sink and suspects keys 4, 7, 9 and 12. It sends them to the connector with verify-keys-absent. The connector reads those keys at the source between its own low and high watermarks, finds 9 present and 4, 7 and 12 absent, and emits absence events for 4, 7 and 12 at its high watermark. The sink applies them as deletes in stream order, and the live row 9 stays. The drift process never deletes from the sink.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 6: The drift process suspects keys 4, 7, 9 and 12 and sends them with verify-keys-absent. The connector reads them at the source between its own watermarks, finds 9 present and emits absence events only for 4, 7 and 12. The drift process never deletes from the sink.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;As Figure 6 shows, a suspect that is still live at the source is safe because the key-list query returns &lt;code&gt;9&lt;/code&gt; (or the log window shows a change to it), so the connector emits nothing for it and only the confirmed orphans &lt;code&gt;4&lt;/code&gt;, &lt;code&gt;7&lt;/code&gt; and &lt;code&gt;12&lt;/code&gt; receive absence events.&lt;/p&gt;
&lt;h2 id=&quot;three-operating-modes-and-tradeoffs&quot;&gt;Three Operating Modes and Tradeoffs&lt;/h2&gt;
&lt;p&gt;Because chunk-driven absence and &lt;code&gt;verify-keys-absent&lt;/code&gt; share the same watermark mechanism and output events, you can run them in three operating modes depending on your infrastructure:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Mode 1: Fully integrated chunk pass.&lt;/strong&gt; Every chunk read emits either a chunk info record or per-key absence events (using candidate keys scanned from the connector’s compacted topic). A single pass over the table repairs missing rows, wrong column values and removes orphans. This fits both on-demand recovery after an incident and scheduled periodic sweeps.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mode 2: External drift process with &lt;code&gt;verify-keys-absent&lt;/code&gt;.&lt;/strong&gt; Chunk reads remain unchanged and only emit present rows. An external drift detector periodically inspects the sink, identifies suspect keys and submits them to the connector via &lt;code&gt;verify-keys-absent&lt;/code&gt;. This avoids scanning full table chunks when you only want to clean up suspected orphans and it also catches orphans injected into the sink by side writes outside the pipeline.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mode 3: Combined mode (recommended for production).&lt;/strong&gt; You run chunk passes as in Mode 1, while an external drift process submits any residual suspect keys via &lt;code&gt;verify-keys-absent&lt;/code&gt;. In the paper, we also describe an &lt;strong&gt;end-of-pass bounds hand-off&lt;/strong&gt;, where the connector publishes the key bounds a pass covered, so an external handler can look for sink keys outside them and submit any it finds via &lt;code&gt;verify-keys-absent&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Figure 7 brings all of this together. It is the high-level architecture of Mode 3 and shows every component of our extension: the chunk passes that state absence, the &lt;code&gt;verify-keys-absent&lt;/code&gt; request and the external drift process.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/evolving-from-pure-cdc-to-full-data-synchronization-with-dblog-based-incremental-snapshots/06-mode-3-architecture.png&quot; width=&quot;2400&quot; height=&quot;582&quot; alt=&quot;The source database sends CDC events to the connector, and the connector reads table chunks from the source with SELECTs. The connector writes one stream to the sink: a change event for order 9 from the log, rows and an absence event for order 4 from a chunk pass, and an absence event for order 12 from a verify-keys-absent request. The drift process reads the sink keys and sends suspect keys to the connector with verify-keys-absent.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 7: High-level architecture of Mode 3. The connector receives CDC events from the source and reads table chunks with SELECTs. One stream carries change events, chunk rows with their absence statements and absence events for keys confirmed on request. Here order 9 changes in the log, a chunk pass finds 4 absent and a request confirms 12 absent. A chunk pass emits absence events one per key, as shown, or states them in one chunk info record for its range. A request always emits absence events per key. The drift process reads the sink&apos;s keys and sends suspects with verify-keys-absent. Solid lines carry events, dashed lines are requests and dotted lines are reads.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;closing&quot;&gt;Closing&lt;/h2&gt;
&lt;p&gt;When we look back at the three steps of CDC, the progression is natural. Tailing the transaction log gave us live changes. Adding watermark-aligned chunk reads gave us source state capture so we could bootstrap and refresh derived stores online. Extending those same watermark windows to also emit what the source &lt;strong&gt;does not contain&lt;/strong&gt; turns a CDC pipeline with DBLog-based incremental snapshots into a complete data synchronization engine, whether a sink catches up on live changes or missing rows, holds wrong column values, or contains orphan rows. Our focus in this work is on row-state synchronization and drift, while schema evolution remains out of scope.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://arxiv.org/abs/2611.10810&quot;&gt;full paper&lt;/a&gt; is written with practitioners in mind and goes into further practical detail on applying these mechanisms in Debezium and Apache Flink CDC, handling database-specific edge cases and discussing operational considerations.&lt;/p&gt;</content:encoded><category>CDC</category><category>Change-Data-Capture</category><category>DBLog</category><category>Debezium</category></item><item><title>A Verified Theoretical Basis for Incremental Snapshots in Debezium and Flink CDC</title><link>https://aandreakis.com/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc</link><guid isPermaLink="true">https://aandreakis.com/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc</guid><description>Machine-checked Generalized DBLog contract unifying classic DBLog, Debezium, and Apache Flink CDC incremental snapshots.</description><pubDate>Wed, 16 Sep 2026 11:29:00 GMT</pubDate><content:encoded>&lt;p&gt;In &lt;a href=&quot;https://netflixtechblog.com/dblog-a-generic-change-data-capture-framework-69351fb9099b&quot;&gt;2019&lt;/a&gt; we introduced &lt;a href=&quot;https://aandreakis.com/dblog&quot;&gt;DBLog&lt;/a&gt;, a Change-Data-Capture (CDC) framework developed at Netflix, to capture real-time database changes and propagate them to downstream systems like Elasticsearch and cache clusters. In addition to live change capture from a commit log, downstream systems often need the full state of a source, and not only as an initial one-time copy. A fresh copy is needed to get previously skipped data (like a table you thought you could exclude) and for repairs. DBLog addresses these requirements by copying a full table or specific keys in chunks and by interleaving them with log events without stalling the change event stream. In order to prevent chunk data from overwriting more recent log events, each chunk read is bracketed by two watermark writes.&lt;/p&gt;
&lt;p&gt;Over the following years, this chunked watermark approach inspired teams across the open-source CDC ecosystem. In 2021, Debezium adopted the concept for its &lt;a href=&quot;https://debezium.io/blog/2021/10/07/incremental-snapshots/&quot;&gt;incremental snapshots&lt;/a&gt;, later adding read-only modes for &lt;a href=&quot;https://debezium.io/blog/2022/04/07/read-only-incremental-snapshots/&quot;&gt;MySQL&lt;/a&gt; and &lt;a href=&quot;https://debezium.io/blog/2024/07/01/debezium-2-7-final-released/#read_only_incremental_snapshots&quot;&gt;PostgreSQL&lt;/a&gt; that require no database writes. Apache Flink CDC &lt;a href=&quot;https://github.com/apache/flink-cdc/blob/release-2.0.0/docs/content/connectors/mysql-cdc.md#incremental-snapshot-reading&quot;&gt;adapted the approach&lt;/a&gt; in that same year, reading chunks in parallel and merging log events directly into chunk buffers.&lt;/p&gt;
&lt;p&gt;The question is now, despite their differing mechanics, do these systems guarantee the same outcome without stale overwrites and what theoretical principles make them work ?&lt;/p&gt;
&lt;p&gt;In my recently published paper, &lt;a href=&quot;https://arxiv.org/abs/2609.08160&quot;&gt;Generalized DBLog: A Verified Contract for Interleaving Copied Rows with a Change Log&lt;/a&gt;, I provide that verified theoretical basis. The paper formalizes a generalized contract that connects the original DBLog mechanism with its adaptations in Debezium and Flink CDC. Using machine-checked verification in Isabelle, Lean, and TLA+, the paper proves that all of these variants satisfy the contract and that any system satisfying it delivers the same guarantee: a &lt;strong&gt;virtual cut&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This post examines the verified theory behind incremental snapshots from a practitioner lens. It covers how DBLog established the baseline, how Debezium and Flink CDC adapted the mechanism, the generalized contract that unites them, what a virtual cut is and why it holds across all the variants.&lt;/p&gt;
&lt;h2 id=&quot;newcomer-context-copying-a-live-table-is-tricky&quot;&gt;Newcomer Context: Copying a live table is tricky&lt;/h2&gt;
&lt;p&gt;If you are new to DBLog and incremental snapshots you may be wondering why all of this is needed.&lt;/p&gt;
&lt;p&gt;Because transaction logs have limited retention, they cannot retain the complete history of a source indefinitely. As a result, when bootstrapping a new downstream system, adding a table to an existing pipeline, or repairing corrupted state, the existing table data must be copied directly from the source database.&lt;/p&gt;
&lt;p&gt;However, merging a point-in-time copy with an active change stream introduces several challenges:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Missed updates&lt;/strong&gt;: If there is a gap between the point the table read executes and the point where log streaming begins, any changes committed in that interval are lost. Downstream state remains stale until those rows are updated again.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stale overwrites&lt;/strong&gt;: If a row is copied from the table and applied downstream after a newer change log event for that same row has already been processed, the older copied state overwrites the newer update.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deleted row resurrection&lt;/strong&gt;: If a row is deleted at the source while the table copy is in flight, an older copied version of the row can arrive downstream after the delete, resurrecting the removed row.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Traditional solutions avoid these issues by coordinating the copy through locks or long-running transactions. For example, a global read lock or table lock can be acquired while recording the matching log position, ensuring that log consumption starts precisely where the snapshot ends.&lt;/p&gt;
&lt;p&gt;When we designed DBLog at Netflix, stalling real-time event processing was not an option. We required a solution that could capture data on demand, for all tables, a single table, or specific keys, while application writes and real-time CDC continued without interruption. Additional criteria were minimal impact on the source database and the ability to backfill at any time, not only as a one-time operation.&lt;/p&gt;
&lt;p&gt;However, if bootstrapping a sink as quickly as possible matters most, then a classic pause-writes-or-events approach with a full table dump and load can be the better approach.&lt;/p&gt;
&lt;h2 id=&quot;the-baseline-dblog&quot;&gt;The Baseline: DBLog&lt;/h2&gt;
&lt;p&gt;DBLog reads tables in chunks ordered by primary key and uses a low and high watermark to bracket each chunk read. Watermarks are implemented by writing updates to a dedicated single-row table that DBLog maintains on the source database. Each update of the watermark table produces an ordinary change event that appears in the database’s change log. These events serve as markers in the log stream that DBLog detects during its processing.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc/fig1_dblog_watermarks.png&quot; width=&quot;1800&quot; height=&quot;941&quot; alt=&quot;Timeline diagram showing DBLog’s watermarking algorithm on a single chunk. The source database timeline shows a low watermark write, a SELECT query reading keys k1, k2, and k3 into memory, and a high watermark write. In the change log below, the resulting ‘lo’ and ‘hi’ events bracket a window containing changes for k7, k2, and k5. In the chunk buffer, key k2 is crossed out and marked dropped due to the k2 update in the window. The surviving keys k1 and k3 are emitted right after the high watermark.&quot; loading=&quot;eager&quot; fetchpriority=&quot;high&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 1: The original DBLog algorithm. In this example, the SELECT runs at a log position between lo and hi. Selected rows whose keys show up inside the window are dropped, because the log carries the latest version of them.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;For each chunk, DBLog executes the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Briefly pause log event processing.&lt;/li&gt;
&lt;li&gt;Write the low watermark update to the watermark table.&lt;/li&gt;
&lt;li&gt;Execute a &lt;code&gt;SELECT&lt;/code&gt; to read the next chunk into memory.&lt;/li&gt;
&lt;li&gt;Write the high watermark update to the watermark table.&lt;/li&gt;
&lt;li&gt;Resume log event processing. From the low watermark event onward, check each change log event: if its primary key matches a row in the buffered chunk, remove that row from the buffer. The change log event itself is forwarded downstream as usual.&lt;/li&gt;
&lt;li&gt;When the high watermark event is received from the change log, emit all remaining rows from the chunk buffer to the output writer before resuming normal log event processing.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Figure 1 illustrates this process for a chunk containing keys k1, k2, and k3. The log position at which the &lt;code&gt;SELECT&lt;/code&gt; query executed against the database storage engine is unknown. Because the read occurred after the low watermark transaction committed and before the high watermark transaction committed, its execution point is guaranteed to lie within the window bounded by the two watermarks, as long as commits become visible in change log order.&lt;/p&gt;
&lt;p&gt;This boundary is all that is needed to make sure no copied row overwrites a newer change:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If a row changes within the window (such as k2 in the figure), the change log carries a committed event that reflects the newer state. The copied row in memory is dropped, allowing the change log event to update downstream state.&lt;/li&gt;
&lt;li&gt;If a row does not appear in the change log between the watermarks (like k1 and k3), the row was not modified while the chunk was being read. Its state at the end of the window is identical to its state when read, making it safe to emit after the high watermark.&lt;/li&gt;
&lt;li&gt;Change events for rows outside the current chunk (such as k5) simply pass through to the output.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Operating in chunks provides several practical advantages. The pause on log processing during steps 1-4 is brief because watermark updates and chunk reads are lightweight operations. Also, chunk processing can be throttled, paused, resumed after failures, or targeted at specific subsets of data without restarting the entire table dump.&lt;/p&gt;
&lt;h2 id=&quot;debeziums-approach&quot;&gt;Debezium’s approach&lt;/h2&gt;
&lt;p&gt;Debezium adopted the DBLog chunking mechanism in version 1.6 under the name incremental snapshots. The initial implementation does windowing by writing to a signaling table. In version 1.7, Shopify contributed a read-only mode for MySQL that uses GTID sampling instead. In version 2.7, Debezium added a read-only mode for PostgreSQL that samples the server’s transaction snapshot.&lt;/p&gt;
&lt;h3 id=&quot;signal-table-mode&quot;&gt;Signal-Table Mode&lt;/h3&gt;
&lt;p&gt;In this mode, Debezium integrates the watermark concept with its existing signaling table infrastructure. The signaling table is a captured table used to send operational commands to the connector.&lt;/p&gt;
&lt;p&gt;When an incremental snapshot is triggered, the connector does these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Insert a &lt;code&gt;snapshot-window-open&lt;/code&gt; record into the signaling table.&lt;/li&gt;
&lt;li&gt;Execute a &lt;code&gt;SELECT&lt;/code&gt; to read the chunk into memory.&lt;/li&gt;
&lt;li&gt;Insert a &lt;code&gt;snapshot-window-close&lt;/code&gt; record into the signaling table.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Both signal inserts appear as change events in the database change log. As log processing advances, Debezium identifies the &lt;code&gt;open&lt;/code&gt; event and begins monitoring change events against its buffered chunk rows. Any row updated or deleted between the &lt;code&gt;open&lt;/code&gt; and &lt;code&gt;close&lt;/code&gt; signals is removed from the buffer. Once the &lt;code&gt;close&lt;/code&gt; signal arrives, the surviving rows are emitted to the output stream.&lt;/p&gt;
&lt;p&gt;Debezium also provides an alternative &lt;code&gt;insert_delete&lt;/code&gt; strategy. In this mode, the connector inserts a signal row to open the window and deletes that same row to close the window, avoiding row accumulation in the signaling table.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc/fig2a_debezium_signal_table.png&quot; width=&quot;1800&quot; height=&quot;577&quot; alt=&quot;Timeline diagram of Debezium’s signal-table incremental snapshot mode. The connector inserts ‘snapshot-window-open’ into the signaling table, executes a SELECT for chunk keys k1, k2, and k3 into memory, and inserts ‘snapshot-window-close’. The signal inserts appear in the binlog as ‘open’ and ‘close’ change events defining the window. Key k2 is updated inside the window and dropped from memory, while the surviving keys k1 and k3 are emitted downstream right after the close event.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 2: Debezium&apos;s signal-table mode. The window edges are rows Debezium inserted into its signal table and then read back from the binlog, like DBLog&apos;s watermarks.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id=&quot;read-only-mode&quot;&gt;Read-Only Mode&lt;/h3&gt;
&lt;p&gt;In some production environments, giving a CDC connector write access to the source database may be prohibited by policy. The read-only mode was built for such cases.&lt;/p&gt;
&lt;p&gt;Rather than writing marker rows to the database, the read-only mode establishes DBLog’s window by querying MySQL’s transaction coordinate state directly. Here, chunk selection works by executing these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Before reading the chunk, run &lt;code&gt;SHOW MASTER STATUS&lt;/code&gt; (or &lt;code&gt;SHOW BINARY LOG STATUS&lt;/code&gt; in MySQL 8.2+) to record the currently executed Global Transaction Identifier (GTID) set as the low boundary (&lt;code&gt;low&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Execute the chunk &lt;code&gt;SELECT&lt;/code&gt; and store its result into memory.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;SHOW MASTER STATUS&lt;/code&gt; again to record the executed GTID set as the high boundary (&lt;code&gt;high&lt;/code&gt;). The difference between the two sets represents all transactions that committed while the chunk read was in flight.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;During binlog processing, every event carries the GTID of its containing transaction. The connector compares each event’s GTID against the two sampled sets:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An event whose GTID is not contained in &lt;code&gt;low&lt;/code&gt; indicates that the window has opened.&lt;/li&gt;
&lt;li&gt;An event whose GTID is contained in &lt;code&gt;high&lt;/code&gt; falls within the window. If its key matches a buffered chunk row, that row is dropped from memory (such as k2 with transaction ID &lt;code&gt;44&lt;/code&gt; in the figure below).&lt;/li&gt;
&lt;li&gt;Once the window is open, an event whose GTID is not contained in &lt;code&gt;high&lt;/code&gt; closes it. The surviving rows are emitted before that event is forwarded.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the source database has low write traffic and no user transactions commit to close the window, MySQL server heartbeat events let the connector close the window.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc/fig2b_debezium_read_only.png&quot; width=&quot;1800&quot; height=&quot;736&quot; alt=&quot;Timeline diagram of Debezium’s read-only snapshot mode on MySQL. The connector runs ‘SHOW MASTER STATUS’ before and after selecting chunk keys k1, k2, and k3 to record executed GTID sets (low: transactions 1–42, high: transactions 43–45). In the binlog, transactions 43 through 45 form the window. Key k2 is dropped from memory because transaction 44 updated it within the window, and the surviving keys k1 and k3 are emitted once the window closes at transaction 46.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 3: Debezium&apos;s read-only mode on MySQL. The connector samples the server&apos;s executed GTID set before and after the chunk read and checks every binlog event against the two samples.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Debezium also implements a read-only mode for MariaDB. MariaDB reports &lt;code&gt;GTID_BINLOG_POS&lt;/code&gt;, a per-replication-domain position rather than MySQL’s complete executed set, and the connector samples that value instead. The connector brackets the chunk read between two samples of that value in the same way.&lt;/p&gt;
&lt;p&gt;PostgreSQL has no executed GTID set to sample. Its read-only mode, available for PostgreSQL 13 and later, calls &lt;code&gt;pg_current_snapshot()&lt;/code&gt; before and after the chunk &lt;code&gt;SELECT&lt;/code&gt; instead. Each sample describes which transactions had completed at that moment: &lt;code&gt;xmin&lt;/code&gt; is the oldest transaction still running, and &lt;code&gt;xmax&lt;/code&gt; is one past the highest transaction ID that has completed. During write-ahead log (WAL) processing, every event carries the ID of its containing transaction. The connector compares each event’s ID against the two samples:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An event whose transaction ID is at least the low sample’s &lt;code&gt;xmin&lt;/code&gt; indicates that the window has opened.&lt;/li&gt;
&lt;li&gt;While the window is open, if an event’s key matches a buffered chunk row, that row is dropped from memory.&lt;/li&gt;
&lt;li&gt;An event whose transaction ID is greater than the &lt;code&gt;xmax&lt;/code&gt; of both samples indicates that the window has closed. The surviving rows are emitted before that event is forwarded.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A transaction that was still running when the low sample was taken cannot have an ID below that sample’s &lt;code&gt;xmin&lt;/code&gt;. A transaction whose ID is above the high sample’s &lt;code&gt;xmax&lt;/code&gt; cannot have completed before the high sample was taken. As long as the two samples line up with the stream the connector is reading, the two comparisons can therefore only make the window wider, never narrower. A wider window only drops a few more copied rows, and the log carries the latest version of those rows anyway.&lt;/p&gt;
&lt;h2 id=&quot;flink-cdcs-approach&quot;&gt;Flink CDC’s approach&lt;/h2&gt;
&lt;p&gt;Apache Flink CDC’s MySQL connector adapted the DBLog protocol for distributed, parallel execution in stream processing pipelines. Flink CDC introduces two major modifications to the original design: chunks are read concurrently by parallel workers, and conflicting change events are merged directly into chunk buffers rather than dropped.&lt;/p&gt;
&lt;h3 id=&quot;parallel-chunk-reading-and-in-memory-merging&quot;&gt;Parallel Chunk Reading and In-Memory Merging&lt;/h3&gt;
&lt;p&gt;In Flink CDC, the source table is split into disjoint primary key ranges (splits) during initialization. These chunks are assigned to parallel snapshot reader tasks.&lt;/p&gt;
&lt;p&gt;As shown in Figure 4, each reader processes a chunk using four steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Query the database to obtain the current binlog offset and record it as &lt;code&gt;LOW&lt;/code&gt;. With GTIDs enabled the offset is the executed GTID set, otherwise the binlog file and position.&lt;/li&gt;
&lt;li&gt;Execute the &lt;code&gt;SELECT&lt;/code&gt; to fetch the chunk rows into an in-memory buffer.&lt;/li&gt;
&lt;li&gt;Query the binlog offset again and record it as &lt;code&gt;HIGH&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Read the binlog between &lt;code&gt;LOW&lt;/code&gt; and &lt;code&gt;HIGH&lt;/code&gt; for events belonging to the chunk’s primary key range, and merge those changes directly into the buffer. An update event replaces the corresponding buffered row, and a delete event removes it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Once the reader completes this local backfill, the buffer reflects the state of all keys in that chunk as of its specific &lt;code&gt;HIGH&lt;/code&gt; offset. The chunk is then emitted downstream as insert events.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc/fig3a_flink_snapshot_phase.png&quot; width=&quot;1800&quot; height=&quot;720&quot; alt=&quot;Process and timeline diagram of Flink CDC’s snapshot phase. Two parallel readers process disjoint key ranges: Reader A for keys k1-k3 and Reader B for keys k4-k6. Each reader samples local LOW and HIGH binlog offsets around its chunk SELECT, then reads the binlog between LOW and HIGH to merge changes directly into its memory buffer. Below, the change log shows overlapping offset windows: Window A merges event k2 into chunk 1, while overlapping Window B merges event k5 into chunk 2 and ignores k2.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 4: Flink CDC&apos;s snapshot phase. Every chunk carries its own window and the windows may overlap. Changes inside a window are merged into the chunk before it is emitted. q marks an event for a row outside both chunks.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Notice that the window boundaries in Flink CDC are recorded binlog offsets, not marker rows written to the database log. While Flink CDC’s codebase uses the terms low and high watermarks, these are internal markers within Flink’s runtime dataflow, not writes to the database. Because chunks are assigned to independent parallel readers, their offset windows overlap freely in the binlog. This concurrency is safe because each reader filters the binlog strictly for keys within its assigned chunk.&lt;/p&gt;
&lt;h3 id=&quot;the-streaming-phase-gate&quot;&gt;The Streaming Phase Gate&lt;/h3&gt;
&lt;p&gt;Once all parallel chunk reads are complete, Flink CDC transitions to a streaming phase where a single binlog reader tails the database log continuously.&lt;/p&gt;
&lt;p&gt;Because each chunk was finalized at its own &lt;code&gt;HIGH&lt;/code&gt; offset, different chunks reflect the database state at different points in the log. To ensure no changes are missed, the streaming reader starts reading from the minimum &lt;code&gt;HIGH&lt;/code&gt; offset across all completed chunks.&lt;/p&gt;
&lt;p&gt;Starting at this earlier offset means the reader will encounter events that have already been merged into chunk buffers. To prevent applying older changes over newer data, Flink CDC applies a gating mechanism to every incoming binlog event:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;For each event, the reader identifies which chunk owns the event’s primary key.&lt;/li&gt;
&lt;li&gt;If the event’s binlog offset is less than or equal to that chunk’s &lt;code&gt;HIGH&lt;/code&gt; offset, the event is discarded because its state is already incorporated into the emitted chunk (such as k5 at or before &lt;code&gt;HIGH_B&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;If the event’s offset is strictly greater than that chunk’s &lt;code&gt;HIGH&lt;/code&gt; offset, the event is emitted downstream (such as k1, k6, and k3).&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc/fig3b_flink_streaming_phase.png&quot; width=&quot;1800&quot; height=&quot;532&quot; alt=&quot;Timeline diagram illustrating event gating in Flink CDC’s streaming phase. The single binlog reader begins reading at the earliest chunk boundary, HIGH_A. An incoming event for key k5 occurring at or before HIGH_B is skipped because its state was already merged into chunk 2. Subsequent events occurring strictly past their chunk’s HIGH boundary (k1 and k3 past HIGH_A, and k6 past HIGH_B) are emitted downstream.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 5: Flink CDC&apos;s streaming phase. The binlog reader starts at the smallest HIGH and skips any event still at or before the HIGH of the chunk that owns its key, because the merged chunk already has it.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Flink CDC also provides an option to skip the per-chunk binlog backfill. However, Flink’s documentation notes that this mode provides only at-least-once semantics, and it does not satisfy the guarantees discussed below.&lt;/p&gt;
&lt;h2 id=&quot;unifying-the-family-with-generalized-dblog&quot;&gt;Unifying the family with Generalized DBLog&lt;/h2&gt;
&lt;p&gt;While Debezium and Flink CDC developed different operational mechanics, the paper shows that both systems, along with the original DBLog, implement the same core abstraction. This abstraction is now formalized as the &lt;em&gt;Generalized DBLog&lt;/em&gt; contract, structured around four foundational rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Disjoint Partitioning&lt;/strong&gt;: The target dataset is partitioned into disjoint, non-overlapping key ranges (chunks, tables, or discrete key sets).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windowing&lt;/strong&gt;: For each partition, the system establishes a lower and an upper boundary in the change log that enclose the point-in-time read of the chunk. These boundaries can be established by writing watermark rows, sampling server GTID or transaction state, or recording log offsets.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Log Wins&lt;/strong&gt;: Any change log event occurring within a chunk’s window takes precedence over the copied chunk data. Whether a system drops the copied row (as in DBLog and Debezium) or merges the change event into the chunk buffer (as in Flink CDC), the resulting row state is equivalent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Window Completion&lt;/strong&gt;: A partition’s data is only released to downstream consumers after all change events within its window have been fully processed.&lt;/li&gt;
&lt;/ol&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc/fig5_family.png&quot; width=&quot;1800&quot; height=&quot;1020&quot; alt=&quot;Comparison table illustrating the Generalized DBLog protocol family across five approaches: Classic DBLog, Debezium signal-table, Debezium read-only, Flink CDC, and Exact-position dumps. For each approach, the table diagrams how window boundaries are demarcated in the change log (‘lo’/‘hi’ marker events, ‘open’/‘close’ signal events, sampled GTID boundaries, recorded binlog offsets, or zero-width exact positions) and how concurrent changes inside the window are reconciled (dropping copied rows in DBLog and Debezium, merging changes into chunk buffers in Flink CDC, or requiring no reconciliation for exact dumps).&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 6: The family in one picture. q marks events for other rows, k the copied row that changed inside the window.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Figure 6 illustrates how these systems form a cohesive protocol family based on the same principles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Classic DBLog&lt;/strong&gt;: Watermark rows written to a dedicated table define the window. Conflicting copied rows are dropped.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debezium Signal-Table&lt;/strong&gt;: Command rows written to the signal table define the window. Conflicting copied rows are dropped.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debezium Read-Only&lt;/strong&gt;: Sampled GTID sets (MySQL, MariaDB) or transaction snapshots (PostgreSQL) define the window without database writes. Conflicting copied rows are dropped.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Flink CDC&lt;/strong&gt;: Binlog offsets define the window. Change events within the window are merged into the chunk buffer before emission.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exact-Position Dumps&lt;/strong&gt;: Tools like &lt;code&gt;mysqldump&lt;/code&gt; (with &lt;code&gt;--single-transaction --source-data&lt;/code&gt;), &lt;code&gt;mariadb-dump&lt;/code&gt;, &lt;code&gt;pg_dump&lt;/code&gt; with an exported replication snapshot, or Debezium’s initial snapshot represent a degenerate case where window width is zero (&lt;code&gt;LOW = HIGH&lt;/code&gt;). Because the read corresponds to an exact log coordinate, there are no concurrent changes to reconcile.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bounded Restores&lt;/strong&gt;: A restored database backup whose commit position is unknown but bounded between known start and end log positions behaves as a wide window. Applying the change log from the start boundary and discarding restored rows modified between the two boundaries satisfies the same contract.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because chunks are processed independently, these strategies can be composed within the same system. For example, a pipeline could perform an exact-position snapshot for one table, execute watermark-based chunking on another, and restore a third table from a backup, with the same guarantee holding across all three.&lt;/p&gt;
&lt;h2 id=&quot;what-you-get-a-virtual-cut&quot;&gt;What you get: a virtual cut&lt;/h2&gt;
&lt;p&gt;The central contribution of the Generalized DBLog paper is establishing the guarantee downstream consumers receive when these rules are followed.&lt;/p&gt;
&lt;p&gt;Even though chunks are read at different points in time, without global table locks and without pausing concurrent write traffic, replaying the emitted stream reconstructs the state of the source database at a single point in the change log: a &lt;strong&gt;virtual cut&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It is worth clarifying where this cut is constructed and stored. While a chunk window is open, DBLog holds the chunk buffer and the window boundaries. Once the window closes and the surviving rows are emitted, the buffer is gone. There is no snapshot and no cut record inside the connector, and the same is true for Debezium and Flink CDC. The cut is a property of the stream these systems emit, and it turns into concrete rows only where that stream is applied: in the sink table, in a consumer that folds the topic into a table, or in a test that replays the output into a map. That is what &lt;em&gt;&lt;strong&gt;virtual&lt;/strong&gt;&lt;/em&gt; means. The state exists only as the result of replaying the stream, which is why the approach is cheap at the source and why it needs a proof.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/a-verified-theoretical-basis-for-incremental-snapshots-in-debezium-and-flink-cdc/fig4_virtual_cuts.png&quot; width=&quot;1800&quot; height=&quot;1009&quot; alt=&quot;Diagram showing virtual cut progression (f to f’ to f″) across four keys (k1 to k4). Chunk 1 reads k1 and k2 between lo_1 and hi_1, dropping k2 due to an in-window update to B’, establishing partial cut f with {k1: A, k2: B’}. Chunk 2 reads k3 and k4 between lo_2 and hi_2, dropping k4 due to an in-window delete. At cut point f’ after hi_2, all keys are covered, yielding a virtual cut of {k1: A, k2: B’, k3: C}. A subsequent log update to k3 (C’) advances the virtual cut to position f″.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Figure 7: Virtual cut progression (f→f’→f’’) across two chunk reads and one update. Reading down any cut line gives exactly the rows the database had at that log position. q marks an event for a row outside the scope.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In this context, “replaying” means applying the emitted stream, both chunk rows and change log events in the order they were produced, to a downstream store using a latest-event-wins policy per primary key. The sink only needs to upsert on chunk rows and update events and delete on delete events. It does not need to know where the windows were, when the chunks were read, or which rows came from a chunk and which from the log.&lt;/p&gt;
&lt;p&gt;Figure 7 demonstrates how a virtual cut materializes across four keys (k1, k2, k3, k4) and how it progresses:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Chunk 1 reads keys k1 and k2 between watermarks &lt;code&gt;lo_1&lt;/code&gt; and &lt;code&gt;hi_1&lt;/code&gt;. The read captures &lt;code&gt;k1 = A&lt;/code&gt; and &lt;code&gt;k2 = B&lt;/code&gt;. During chunk 1’s window, an application transaction commits an update setting &lt;code&gt;k2 = B′&lt;/code&gt;. Because k2 changed inside the window, the copied row B is dropped from the chunk buffer.&lt;/li&gt;
&lt;li&gt;At cut point &lt;code&gt;f&lt;/code&gt; (immediately after chunk 1 closes), chunk 1 emits &lt;code&gt;k1 = A&lt;/code&gt;, and the change log carries &lt;code&gt;k2 = B′&lt;/code&gt;. Replaying the stream up to &lt;code&gt;f&lt;/code&gt; yields &lt;code&gt;{k1: A, k2: B′}&lt;/code&gt;, matching the database state for those keys at log position &lt;code&gt;f&lt;/code&gt;. Rows k3 and k4 have not yet been read, so no claim is made about them.&lt;/li&gt;
&lt;li&gt;Chunk 2 reads keys k3 and k4 between watermarks &lt;code&gt;lo_2&lt;/code&gt; and &lt;code&gt;hi_2&lt;/code&gt;. The read captures &lt;code&gt;k3 = C&lt;/code&gt; and &lt;code&gt;k4 = D&lt;/code&gt;. During chunk 2’s window, an application transaction commits a delete for k4. The copied row for k4 is dropped.&lt;/li&gt;
&lt;li&gt;At cut point &lt;code&gt;f&apos;&lt;/code&gt; (after chunk 2 closes), chunk 2 emits &lt;code&gt;k3 = C&lt;/code&gt;, and the delete event for k4 is streamed. Replaying the output up to &lt;code&gt;f&apos;&lt;/code&gt; yields &lt;code&gt;{k1: A, k2: B′, k3: C}&lt;/code&gt;. This matches the state of the database at log position &lt;code&gt;f&apos;&lt;/code&gt; across all four keys.&lt;/li&gt;
&lt;li&gt;As log processing continues, a subsequent update sets &lt;code&gt;k3 = C′&lt;/code&gt; at position &lt;code&gt;f&apos;&apos;&lt;/code&gt;. The reconstructed state advances to &lt;code&gt;{k1: A, k2: B′, k3: C′}&lt;/code&gt;, matching the database at &lt;code&gt;f&apos;&apos;&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A cut covers every selected key once the last window has closed and the log has been consumed up to that point (&lt;code&gt;f&apos;&lt;/code&gt; in Figure 7). From that position on, the sink holds what it would hold had a single snapshot over the selected scope (full table, or specific keys) been taken at that moment, even though the chunks were read separately. Until then, only the keys of completed chunks are guaranteed to match the source database, so a consumer that needs every key to match the source at one log position has to wait for that point. After that, every change event the sink applies moves the cut forward by one position (&lt;code&gt;f&apos; -&gt; f&apos;&apos;&lt;/code&gt;), so the sink always matches the source database as of the last event it applied. There is no hand-off between a snapshot phase and a streaming phase in what the sink sees.&lt;/p&gt;
&lt;h3 id=&quot;why-the-guarantee-holds&quot;&gt;Why the Guarantee Holds&lt;/h3&gt;
&lt;p&gt;The reason this guarantee holds can be understood by considering each row individually. For any given key, only two cases are possible:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;The row changed inside or after its chunk window&lt;/strong&gt;: The change log records every modification to the row in commit order. Consequently, the latest change event at or before the cut point determines the row’s value, matching the database state at the cut.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The row did not change after its read&lt;/strong&gt;: Because no transactions modified the row between the chunk read and the cut point, the copied value was correct when read, remained correct at the end of the window, and remains correct at the cut.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There are no other cases. The validity of this argument does not depend on knowing the exact moment the &lt;code&gt;SELECT&lt;/code&gt; query ran within the window, the duration of the window, or whether chunks were processed serially or concurrently. Once all chunks are complete and the log has been consumed through the largest high boundary, the stream establishes a virtual cut across all selected keys. Subsequent change log events advance that cut.&lt;/p&gt;
&lt;h3 id=&quot;scope-boundaries&quot;&gt;Scope Boundaries&lt;/h3&gt;
&lt;p&gt;Three important boundaries should be noted regarding this guarantee:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Row-level versus transactional&lt;/strong&gt;: A virtual cut reconstructs the state of each row as of a specific coordinate in the change log. If a cut point falls in the middle of a multi-row database transaction, the reconstructed state will reflect the subset of rows committed up to that log offset. For the reconstructed state to contain only whole transactions, the cut must be aligned with a transaction boundary, which GTID-based coordinates provide naturally.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Output stream versus downstream sinks&lt;/strong&gt;: The guarantee applies to the stream as emitted by the capture process. How downstream sinks apply that stream, including handling out-of-order delivery, network retries, and idempotency, is an orthogonal challenge. This is discussed further in an earlier blog post: &lt;a href=&quot;https://aandreakis.com/posts/change-data-capture-doesnt-solve-dual-writes&quot;&gt;CDC Doesn’t Solve Dual Writes&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Repairing a populated sink&lt;/strong&gt;: The proofs assume an empty sink. Applied to a non-empty sink, the stream updates every row it carries. But a row that the source deleted before the copy started appears in no chunk and gets no delete event, so it can survive downstream. If parity with the source database matters, the pipeline must clear the sink first or emit tombstones for previously deleted rows.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;fine-print&quot;&gt;Fine print&lt;/h2&gt;
&lt;p&gt;The paper analyzes the preconditions required for the Generalized DBLog contract to hold in production systems. For developers maintaining CDC connectors or implementing custom snapshot engines, the following requirements are essential:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Full Row Images in the Change Log&lt;/strong&gt;: Change log update events must include the complete post-image of the row, rather than only the modified columns (like &lt;code&gt;binlog_row_image=FULL&lt;/code&gt; in MySQL). If an update event carries only partial column changes, dropping a copied row in favor of the log event would result in missing column values downstream.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stable Row Identifiers&lt;/strong&gt;: Tables must have a primary key or immutable unique key to correlate chunk reads with log events. If a primary key is modified, the database or connector must represent this change as a delete of the old key followed by an insert of the new key.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Snapshot-Style Chunk Scans (Completeness)&lt;/strong&gt;: The chunk &lt;code&gt;SELECT&lt;/code&gt; must run against a statement snapshot so that every row in the scanned range is observed. In our original 2020 paper, we stated this requirement as “non-stale reads”, meaning the scan observes changes committed prior to its execution. However, that definition is underspecified as it constrains the values of the rows that come back, not which rows come back. If a scan misses a row that never changes afterwards, no change log event will ever mention it and nothing repairs the omission. Under a locking Read Committed level, such as SQL Server’s default, shared locks are released as the scan advances, and Microsoft’s locking guide documents that a concurrent key update can move a row within the index so that the scan sees it twice or not at all. In that documented case the moved row was itself updated, so its own log event would repair it, but it shows that a lock-based scan offers no completeness guarantee. MVCC-based statement snapshots (standard in MySQL InnoDB and PostgreSQL) provide that guarantee by design.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Visibility in Log Order&lt;/strong&gt;: A chunk read must also see every transaction that precedes its low watermark in the change log. MySQL guarantees this by default (&lt;code&gt;binlog_order_commits&lt;/code&gt;). PostgreSQL does not guarantee this. It writes a committing transaction to the WAL, where it can be streamed, before other sessions can see it. So, a transaction logged later, such as the low watermark, can become visible first. This interval is normally very short, and the chunk must also contain a row that the earlier transaction changed, so the chance that a chunk read is affected is low. If it is affected however, a chunk read that starts in that interval misses the earlier transaction’s changes. Unless such a row changes again inside the window, its copied old value is emitted after the newer change and stays until the row changes again. A deleted row comes back the same way. For captures that write watermarks, the paper describes a remedy based on the read’s own snapshot (&lt;code&gt;pg_current_snapshot()&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sufficient Change Log Retention&lt;/strong&gt;: The database must retain its change log from the lowest open window boundary until all active windows are closed. For Flink CDC, the log segment between &lt;code&gt;LOW&lt;/code&gt; and &lt;code&gt;HIGH&lt;/code&gt; must remain available until parallel workers complete their local backfill.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Watermarks as a Mechanism, Not a Requirement&lt;/strong&gt;: Our 2019 framework introduced watermarks as writes to a dedicated database table. However, watermarking is simply one mechanism for establishing log boundaries. Read-only approaches prove that external coordinates, such as sampled GTID sets or transaction snapshots, can satisfy the contract without requiring write access to the source database.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Strict Window Termination&lt;/strong&gt;: Buffered chunk rows must not be emitted before every change event inside the window has been processed. In read-only modes, when an ordinary change event outside the window reveals its end, the surviving rows must be emitted before that event is forwarded. Quiet database conditions (aka no changes occurred) additionally require heartbeat events to trigger window termination.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Flink-Specific Operational Constraints&lt;/strong&gt;: In parallel architectures like Flink CDC, chunk partitioning keys must remain immutable during the snapshot phase to prevent rows from migrating between chunk ranges. Additionally, the stream must preserve CDC operation semantics (inserts, updates, and deletes). An append-only transport that erases operation types cannot correctly apply log precedence. Finally, bypassing the per-chunk binlog backfill reduces the delivery to at-least-once.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;the-paper&quot;&gt;The paper&lt;/h2&gt;
&lt;p&gt;The formal foundation for this work is detailed in my paper, &lt;a href=&quot;https://arxiv.org/abs/2609.08160&quot;&gt;Generalized DBLog: A Verified Contract for Interleaving Copied Rows with a Change Log&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The paper defines the unified contract, proves that classic DBLog, Debezium (signal-table mode and the MySQL and PostgreSQL read-only modes), Flink CDC, exact-position dumps, and bounded restores satisfy it. It also establishes the operational conditions required by each. The theoretical development is machine-checked in Isabelle, the core virtual cut theorem is independently verified in Lean, and protocol variants are model-checked in TLA+.&lt;/p&gt;
&lt;p&gt;There is also a dedicated section in the paper for engineers building or maintaining CDC connectors. For an animated walkthrough of how the algorithm works, start with my &lt;a href=&quot;https://aandreakis.com/dblog&quot;&gt;interactive introduction to DBLog&lt;/a&gt;. The earlier paper, &lt;a href=&quot;https://arxiv.org/abs/2605.31475&quot;&gt;A Theoretical Study of DBLog&lt;/a&gt;, establishes the formal proof for the original algorithm, while the &lt;a href=&quot;https://netflixtechblog.com/dblog-a-generic-change-data-capture-framework-69351fb9099b&quot;&gt;2019 Netflix TechBlog post&lt;/a&gt; introduces the original production design.&lt;/p&gt;</content:encoded><category>CDC</category><category>Change-Data-Capture</category><category>DBLog</category><category>Debezium</category></item><item><title>Change-Data-Capture Doesn’t Solve Dual-Writes</title><link>https://aandreakis.com/posts/change-data-capture-doesnt-solve-dual-writes</link><guid isPermaLink="true">https://aandreakis.com/posts/change-data-capture-doesnt-solve-dual-writes</guid><description>Why Change-Data-Capture moves dual writes downstream rather than solving them, with machine-checked commit-log recovery proofs.</description><pubDate>Wed, 05 Aug 2026 11:34:00 GMT</pubDate><content:encoded>&lt;p&gt;A request writes to a database, then updates a search index, a cache, and calls an external service. All of this often happens within one process that handles a request and issues multiple writes as part of its operation. This is a &lt;strong&gt;dual write&lt;/strong&gt; and the common advice is to &lt;a href=&quot;https://www.confluent.io/blog/using-logs-to-build-a-solid-data-infrastructure-or-why-dual-writes-are-a-bad-idea/&quot;&gt;avoid it&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The solution against multiple writes from the same process is Change-Data-Capture (CDC). That way, a request handler only writes to one database, and another process tails its transaction log and asynchronously applies additional writes to downstream systems. Over the last few years CDC has moved from niche to mainstream. Debezium has shipped connectors for several databases, Flink CDC is widely used, and cloud providers offer managed CDC services. One could assume that &lt;em&gt;dual writes are solved&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;However, &lt;strong&gt;CDC does not solve dual writes&lt;/strong&gt; and I published a &lt;a href=&quot;https://arxiv.org/abs/2608.00501&quot;&gt;new paper&lt;/a&gt; that discusses this in detail.&lt;/p&gt;
&lt;p&gt;What CDC actually does is that it moves additional writes one stage downstream and makes them &lt;em&gt;retryable&lt;/em&gt;, though usually only &lt;em&gt;for some time&lt;/em&gt;. Those are genuinely valuable properties. They do not, however, solve the underlying problem.&lt;/p&gt;
&lt;h2 id=&quot;the-dual-write-everyone-knows&quot;&gt;The dual write everyone knows&lt;/h2&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/change-data-capture-doesnt-solve-dual-writes/fig1_dual_write.png&quot; width=&quot;1800&quot; height=&quot;900&quot; alt=&quot;One handler with four calls and no shared transaction. The database commit completes, but the system never records that the remaining work still needs to be done.&quot; loading=&quot;eager&quot; fetchpriority=&quot;high&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;&lt;em&gt;One handler with four calls and no shared transaction. The database commit completes, but the system never records that the remaining work still needs to be done.&lt;/em&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Assume an order service that needs to update multiple endpoints, several stores and one external API. The naive, single-process dual writes version can fail in unspectacular ways. Assume the process dies after the database commit and before the index update. Then, the order exists but search cannot find it. Then assume the email API call times out after the commit. If it is retried a customer may get two mails, and if we skip it and they may get none. No transaction spans PostgreSQL, Elasticsearch, and an email provider, so all of these outcomes are reachable. The source database can be fine while the damage sits in systems that do not know what they missed.&lt;/p&gt;
&lt;p&gt;Two separate things make this hard. It is worth keeping them apart, because CDC fixes one and not the other:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;The remaining work is not durable.&lt;/strong&gt; If the process dies halfway through the fan-out, the database commit survives but the unfinished downstream writes may leave no trace. Recovery has nothing from which to resume.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The receiving side may not tolerate redelivery.&lt;/strong&gt; Repeating a version-aware upsert can be harmless. Sending the same email twice is not.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;the-cdc-answer&quot;&gt;The CDC answer&lt;/h2&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/change-data-capture-doesnt-solve-dual-writes/fig2_cdc_promise.png&quot; width=&quot;1920&quot; height=&quot;840&quot; alt=&quot;The application writes once and everything else is derived from the transaction log.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;&lt;em&gt;The application writes once and everything else is derived from the transaction log.&lt;/em&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;With CDC, the handler writes to the database and is done. The transaction log records committed changes durably and in order. A connector later tails that log and applies the changes to the index, cache, and the email service.&lt;/p&gt;
&lt;p&gt;This genuinely fixes the first problem. The fan-out now starts from a durable, ordered record. If the pipeline dies mid-flight, it can resume from that point. This way, a downstream failure stops being silent divergence and becomes &lt;strong&gt;lag&lt;/strong&gt;, a number we can graph and alert on. Together with source ordering and replay, this is the honest core of CDC’s value and why the architecture deserves its popularity.&lt;/p&gt;
&lt;p&gt;On a brief look, the problem now looks solved.&lt;/p&gt;
&lt;h2 id=&quot;look-one-stage-further&quot;&gt;Look one stage further&lt;/h2&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/change-data-capture-doesnt-solve-dual-writes/fig3_relay_dual_write.png&quot; width=&quot;1800&quot; height=&quot;1020&quot; alt=&quot;The same fan-out, one stage later. The relay writes to a sink and separately records its progress. Two steps with no shared transaction. Aka, a dual write with better tooling.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;&lt;em&gt;The same fan-out, one stage later. The relay writes to a sink and separately records its progress. Two steps with no shared transaction. Aka, a dual write with better tooling.&lt;/em&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Following a change past the log. It still has to land in the search index, cache, and still has to reach the email API. Those writes did not disappear. They happen later, issued by the pipeline instead of the request handler, against endpoints that can still be down and with calls that can still fail.&lt;/p&gt;
&lt;p&gt;For each event the delivery process performs two durable acts: it writes to a sink and records its own progress in an offset, checkpoint, or cursor. The sink’s acceptance and the relay’s progress become durable in independent systems, with no transaction spanning both. This is the same dual-write structure we started with. &lt;strong&gt;The remedy for dual writes is itself implemented as a dual write.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Distributed transactions are a genuine solution to dual writes. For this relay, each sink write must commit atomically with the progress update that records it as complete, so both commit or neither does. In practice, &lt;a href=&quot;https://martin.kleppmann.com/2019/05/01/olep-cacm.html&quot;&gt;heterogeneous distributed transactions remain difficult&lt;/a&gt; because every participant must support a compatible protocol, and the guarantee is limited by the least capable system. Many datastores do not support one and external APIs typically cannot participate. So, any sink outside the transaction leaves the dual-write problem intact.&lt;/p&gt;
&lt;h2 id=&quot;side-effects&quot;&gt;Side effects&lt;/h2&gt;
&lt;p&gt;Suppose the pipeline sends a confirmation email for order 41 and crashes before committing its offset. On restart, the checkpoint still says 40. Should it send 41 again? If the provider accepted the first request, retrying sends a duplicate. If it does not, skipping loses the email.&lt;/p&gt;
&lt;p&gt;The paper proves that both executions (one where the email went out and one where it did not) can end in exactly the same state on the pipeline’s side: the same database, the same log, the same outbox and acknowledgements, the same checkpoint. A restart that reads only that state must act the same way in both runs, and whichever way it acts, it sends a duplicate in one case or drops the email in the other. The checkpoint is not buggy. It never observed whether the receiver accepted the effect. Only receiver-side evidence can distinguish the cases.&lt;/p&gt;
&lt;p&gt;For a version-aware index upsert, this ambiguity is harmless. Retrying writes the same document. An email, payment, or push notification is different. Safe redelivery requires a stable idempotency key or an authoritative accepted-request record at the receiver. Without either, the pipeline must choose between a possible duplicate and a possible omission.&lt;/p&gt;
&lt;p&gt;CDC moves this crash window downstream and puts replayable history behind it. It does not solve the problem of side effects.&lt;/p&gt;
&lt;h2 id=&quot;retries-borrow-time-from-the-log&quot;&gt;Retries borrow time from the log&lt;/h2&gt;
&lt;p&gt;So what did the log actually buy ? &lt;strong&gt;Time.&lt;/strong&gt; When the index is down for an hour, events wait in the log, the pipeline retries, and the systems eventually converge. In the naive design, the same failure may create permanent divergence that nobody notices.&lt;/p&gt;
&lt;p&gt;But the time is borrowed. Transaction logs are operational artifacts with retention policies. PostgreSQL replication slots may retain WAL indefinitely by default until consumed. MySQL binlogs expire on a configured timer. MongoDB’s oplog is capped. SQL Server CDC tables have a cleanup policy. Kafka topics have their own settings so entries may or may not be retained. Unbounded retention can threaten the primary system itself. Under sustained write pressure, operators must eventually truncate the history, move it elsewhere, or risk the system’s availability.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/change-data-capture-doesnt-solve-dual-writes/fig4_evidence_lifetime.png&quot; width=&quot;1720&quot; height=&quot;940&quot; alt=&quot;Replay is limited by retention. When lag exceeds the retention window, events that still need to be delivered are no longer available. Sink-side dedup records can expire the same way.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;&lt;em&gt;Replay is limited by retention. When lag exceeds the retention window, events that still need to be delivered are no longer available. Sink-side dedup records can expire the same way.&lt;/em&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This puts a time limit on retries. A connector that stays broken over a long period of time, a sink rebuild that takes several hours, or a forgotten paused pipeline can exceed that limit. If an event disappears from every replayable copy before its downstream work completes, the connector’s cursor may survive, but the event itself does not. The cursor preserves a position, not the content needed to reconstruct the missing work.&lt;/p&gt;
&lt;p&gt;The paper formalizes this limit as the &lt;em&gt;Truncation Dilemma&lt;/em&gt;. Once old content has been truncated, recovery cannot always tell whether recreating an event would restore missing work or invent work that never existed. The important distinction is between content and position. Remembering how far history once extended is not the same as retaining what it contained.&lt;/p&gt;
&lt;p&gt;A common fallback is to rebuild a secondary store from the latest state of a primary store. But a backfill reconstructs state, not history. It can tell a search index that an order is now &lt;em&gt;shipped&lt;/em&gt;. It can not capture previous states of the same row or rows that used to exist and not any longer. Re-deriving a live table without stopping writes is its own problem, the one my &lt;a href=&quot;https://aandreakis.com/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot&quot;&gt;previous post on snapshot-equivalent replay&lt;/a&gt; and the DBLog papers discuss.&lt;/p&gt;
&lt;p&gt;Evidence can expire at the receiver too. Idempotency keys and records of accepted requests are usually retained for finite periods. &lt;a href=&quot;https://docs.stripe.com/api-v2-overview&quot;&gt;Stripe’s API v2, for example, uses a 30-day idempotent replay window&lt;/a&gt;. A retry that arrives after the receiver has forgotten the key may be accepted as a new request.&lt;/p&gt;
&lt;h2 id=&quot;what-cdc-actually-buys&quot;&gt;What CDC actually buys&lt;/h2&gt;
&lt;p&gt;None of this is an argument against CDC. CDC is &lt;a href=&quot;https://aandreakis.com/dblog&quot;&gt;my corner&lt;/a&gt;. This is an argument against assuming that dual writes are fixed. The honest accounting is this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CDC removes the dual write from the request path: one writer and one commit and downstream work follows from the commit log.&lt;/li&gt;
&lt;li&gt;Downstream failure becomes lag: visible and alertable instead of silent divergence.&lt;/li&gt;
&lt;li&gt;Redelivery is not an issue when the sink supports idempotent writes.&lt;/li&gt;
&lt;li&gt;Side-effecting delivery remains a dual write unless the receiver can deduplicate retries or confirm acceptance.&lt;/li&gt;
&lt;li&gt;Every replay and deduplication guarantee holds within an evidence window.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;CDC converts an atomicity problem you cannot solve into a delivery problem you can operate.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;if-you-have-dual-writes-with-or-without-cdc&quot;&gt;If you have dual writes (with or without CDC)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Make store writes idempotent and version-aware, if possible.&lt;/strong&gt; Upsert by key and reject out of order operations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;For actions, negotiate with the receiver or choose your failure.&lt;/strong&gt; Decide whether that endpoint prefers duplicates or omissions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Have a backfill plan when the log history is gone.&lt;/strong&gt; Know which sinks can be rebuilt from current source state, ideally without stopping traffic.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Treat lag versus retention as an SLO.&lt;/strong&gt; Alert on how long remains before the oldest undelivered event falls outside the replay or deduplication window.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;the-paper&quot;&gt;The Paper&lt;/h2&gt;
&lt;p&gt;Most of the advice above is folklore, a decade old, and largely correct. What has been missing is precision about when it works: which recovery decisions are impossible from which evidence, which escapes work under which conditions, what can make a correct answer stale, and how the guarantee expires when its evidence does. That is what the new paper supplies: &lt;a href=&quot;https://arxiv.org/abs/2608.00501&quot;&gt;&lt;em&gt;Machine-Checked Dual-Write Recovery from a Commit Log&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The theory is machine-checked in Isabelle/HOL and a practitioner section turns the results into actionable advice.&lt;/p&gt;
&lt;p&gt;The mental model to keep is simple: A dual write is not solved until the destination can safely absorb or reject a redelivery and the evidence needed for that decision survives long enough. CDC gives you committed history, ordering, retries, observable lag, and time.&lt;/p&gt;</content:encoded><category>CDC</category><category>Change-Data-Capture</category></item><item><title>Snapshot-Equivalent Replay of a Live Table Without Taking a Full Snapshot</title><link>https://aandreakis.com/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot</link><guid isPermaLink="true">https://aandreakis.com/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot</guid><description>How Netflix DBLog backfills live database tables in watermark-bracketed chunks without locks, proven snapshot-equivalent.</description><pubDate>Fri, 05 Jun 2026 12:26:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://aandreakis.com/dblog&quot;&gt;DBLog&lt;/a&gt; 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 &lt;a href=&quot;https://debezium.io/blog/2021/10/07/incremental-snapshots/&quot;&gt;Debezium&lt;/a&gt; and &lt;a href=&quot;https://nightlies.apache.org/flink/flink-cdc-docs-release-3.6/docs/connectors/flink-sources/mysql-cdc/#how-incremental-snapshot-reading-works&quot;&gt;Apache Flink CDC&lt;/a&gt;. The original &lt;a href=&quot;https://netflixtechblog.com/dblog-a-generic-change-data-capture-framework-69351fb9099b&quot;&gt;Netflix blog post&lt;/a&gt; introduces it and the &lt;a href=&quot;https://arxiv.org/abs/2010.12597&quot;&gt;2020 paper&lt;/a&gt; has further details.&lt;/p&gt;
&lt;h2 id=&quot;why-a-theory-paper&quot;&gt;Why a Theory Paper&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;That is exactly what the new paper, &lt;a href=&quot;https://arxiv.org/abs/2605.31475&quot;&gt;A Theoretical Study of DBLog&lt;/a&gt;, delivers. It formalizes what DBLog provides and machine-checks every theorem in Isabelle/HOL.&lt;/p&gt;
&lt;p&gt;This post is a practitioner-oriented explainer of the core idea that the new paper studies.&lt;/p&gt;
&lt;h2 id=&quot;snapshot-equivalence&quot;&gt;Snapshot Equivalence&lt;/h2&gt;
&lt;p&gt;What DBLog achieves and what we have now formally verified can come across as surprising:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;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 &lt;em&gt;different&lt;/em&gt; moments in time, with different data underneath them.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h2 id=&quot;the-primitives-and-the-rule&quot;&gt;The Primitives and the Rule&lt;/h2&gt;
&lt;p&gt;We have four primitives:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;chunk&lt;/strong&gt; is a primary-key range scan &lt;code&gt;SELECT ... WHERE id BETWEEN ...&lt;/code&gt; read live, no lock. Each row becomes a &lt;strong&gt;refresh&lt;/strong&gt;: “key k was observed to be v, at this position in the log.”&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;CDC event&lt;/strong&gt; is a committed change from the database’s log, carrying the full row after the change or its deletion.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;frontier&lt;/strong&gt; &lt;code&gt;f&lt;/code&gt; is 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.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;scope&lt;/strong&gt; &lt;code&gt;K&lt;/code&gt; is the set of keys we are backfilling (not the whole table, more about that later).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;And one rule: Interleave chunk reads with CDC events in log order. To reconstruct the keys &lt;code&gt;K&lt;/code&gt; at &lt;code&gt;f&lt;/code&gt;, walk the stream left-to-right and &lt;strong&gt;for each key the latest event wins.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h2 id=&quot;step-1-a-single-chunk&quot;&gt;Step 1: A Single Chunk&lt;/h2&gt;
&lt;p&gt;Consider three account balances: Alice, Bob, Carol. We will backfill all three, so &lt;code&gt;K = {Alice, Bob, Carol}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Chunk A reads Alice and Bob at log position &lt;code&gt;c1&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Alice = 50
Bob   = 100
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We set &lt;code&gt;f = c1&lt;/code&gt;. Nothing has happened since the read, so Alice and Bob still hold the values we just observed. Replaying the two refreshes → output &lt;code&gt;{Alice: 50, Bob: 100}&lt;/code&gt; = the database at &lt;code&gt;c1&lt;/code&gt; 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 &lt;code&gt;f&lt;/code&gt; forward and study what happens.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot/fig1-step1-single-chunk.png&quot; width=&quot;2000&quot; height=&quot;818&quot; alt=&quot;Step 1 Figure: Chunk A reads Alice and Bob at c1. With the frontier at c1 the replay already equals the database on the keys read so far. Carol&amp;#x27;s chunk has not run yet.&quot; loading=&quot;eager&quot; fetchpriority=&quot;high&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Step 1 Figure: Chunk A reads Alice and Bob at c1. With the frontier at c1 the replay already equals the database on the keys read so far. Carol&apos;s chunk has not run yet.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;step-2-a-concurrent-write&quot;&gt;Step 2: A Concurrent Write&lt;/h2&gt;
&lt;p&gt;Suppose a write changes Bob to 120, committed at &lt;code&gt;c2&lt;/code&gt; &lt;em&gt;after&lt;/em&gt; chunk A already read it as 100.&lt;/p&gt;
&lt;p&gt;Chunk A’s record of Bob is now stale. If the output at &lt;code&gt;f = c2&lt;/code&gt; still said &lt;code&gt;Bob = 100&lt;/code&gt; it would be wrong. The database says 120.&lt;/p&gt;
&lt;p&gt;The log repairs this. We slide the frontier forward to &lt;code&gt;f = c2&lt;/code&gt; and DBLog’s stream now carries that write:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;refresh Bob = 100   (chunk A, at c1)
CDC     Bob = 120   (the write at c2)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replay, latest-event-wins: Bob’s refresh is overwritten by the later CDC event. Bob is now 120, its value at &lt;code&gt;f&lt;/code&gt;, not the 100 we read. The stale 100 doesn’t survive the replay because the log repaired it.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot/fig2-step2-concurrent-write.png&quot; width=&quot;2000&quot; height=&quot;818&quot; alt=&quot;Step 2 Figure: Bob changes at c2 after the chunk A read. The write overwrites the stale read, and the replay at f = c2 matches the database again.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Step 2 Figure: Bob changes at c2 after the chunk A read. The write overwrites the stale read, and the replay at f = c2 matches the database again.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;step-3-a-second-chunk&quot;&gt;Step 3: A Second Chunk&lt;/h2&gt;
&lt;p&gt;Carol’s row was created earlier (an insert before &lt;code&gt;c3&lt;/code&gt;) and read by a &lt;em&gt;different&lt;/em&gt; chunk later. Chunk B reads Carol at &lt;code&gt;c3&lt;/code&gt;: &lt;code&gt;Carol = 25&lt;/code&gt;. Then Carol changes to 35, committed at &lt;code&gt;c4&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Note that chunk A read Alice and Bob at &lt;code&gt;c1&lt;/code&gt;, chunk B read Carol at &lt;code&gt;c3&lt;/code&gt;. There is no single moment when all three were read. The reads are genuinely scattered across the log.&lt;/p&gt;
&lt;p&gt;We slide the frontier to &lt;code&gt;f = c4&lt;/code&gt; and replay the whole stream, latest-event-wins. Carol heals exactly the way Bob did: refresh 25 at &lt;code&gt;c3&lt;/code&gt;, CDC 35 at &lt;code&gt;c4&lt;/code&gt;, latest wins. Alice was read once and never touched again, so the read is &lt;em&gt;already&lt;/em&gt; the value at &lt;code&gt;f&lt;/code&gt;, latest-event-wins just keeps it.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Alice = 50    (read once, never changed)
Bob   = 120   (stale read repaired)
Carol = 35    (stale read repaired)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Output on &lt;code&gt;K&lt;/code&gt;: &lt;code&gt;{Alice: 50, Bob: 120, Carol: 35}&lt;/code&gt;, exactly the database’s state at &lt;code&gt;f = c4&lt;/code&gt; on the three keys.&lt;/p&gt;
&lt;p&gt;They match, including the two keys whose reads were stale. The reads were scattered across &lt;code&gt;c1&lt;/code&gt; and &lt;code&gt;c3&lt;/code&gt;, though the result is pinned to the single frontier &lt;code&gt;c4&lt;/code&gt;.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot/fig3-step3-second-chunk.png&quot; width=&quot;2000&quot; height=&quot;891&quot; alt=&quot;Step 3 Figure: Chunk B reads Carol at c3 and Carol changes at c4. Both stale reads are repaired by the log, and the replay at f = c4 equals the database on all of K.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Step 3 Figure: Chunk B reads Carol at c3 and Carol changes at c4. Both stale reads are repaired by the log, and the replay at f = c4 equals the database on all of K.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;local-reads-global-frontier&quot;&gt;Local Reads, Global Frontier&lt;/h2&gt;
&lt;p&gt;The distinction to keep, because it is the whole idea:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;read coordinate is local&lt;/strong&gt; to each chunk, and therefore to its keys. Alice and Bob at &lt;code&gt;c1&lt;/code&gt;, Carol at &lt;code&gt;c3&lt;/code&gt;. Genuinely different read times.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;cut point &lt;code&gt;f&lt;/code&gt; is global&lt;/strong&gt;, one frontier for all of &lt;code&gt;K&lt;/code&gt;. Every key’s &lt;em&gt;output&lt;/em&gt; is its value at that same &lt;code&gt;f&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The change log is the bridge between them&lt;/strong&gt;. Why does latest-event-wins land on &lt;code&gt;f&lt;/code&gt; exactly ? There are only two cases. If a key changed after its read, the last commit at or before &lt;code&gt;f&lt;/code&gt; determines its value at &lt;code&gt;f&lt;/code&gt;. If the key did not change, the refresh is still right at &lt;code&gt;f&lt;/code&gt;. So the log carries every key from wherever it happened to be read up to the one shared &lt;code&gt;f&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The reads happened at different log positions, the output stands at a single one. That is what snapshot-equivalence means: &lt;strong&gt;the same result we’d get by freezing the database at &lt;code&gt;f&lt;/code&gt; and dumping these keys.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;advancing-the-frontier&quot;&gt;Advancing the Frontier&lt;/h2&gt;
&lt;p&gt;So far this is one cut at one frontier. DBLog doesn’t stop there.&lt;/p&gt;
&lt;p&gt;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 &lt;code&gt;f&lt;/code&gt;, we have a snapshot-equivalent result for all of &lt;code&gt;K&lt;/code&gt; at &lt;code&gt;f&lt;/code&gt;. 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: &lt;code&gt;f → f&apos; → f&apos;&apos;&lt;/code&gt;. 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.&lt;/p&gt;
&lt;p&gt;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 &lt;code&gt;f&lt;/code&gt;.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot/fig4-advancing-the-frontier.png&quot; width=&quot;2000&quot; height=&quot;891&quot; alt=&quot;The complete picture: The bootstrap cut at c4, then one more CDC event, a delete of Alice, advances the same cut to f′ = c5 with no new chunk read.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;The complete picture: The bootstrap cut at c4, then one more CDC event, a delete of Alice, advances the same cut to f′ = c5 with no new chunk read.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;the-watermark-bracket&quot;&gt;The Watermark Bracket&lt;/h2&gt;
&lt;p&gt;Where does a chunk’s log position come from?&lt;/p&gt;
&lt;p&gt;The original DBLog does not know at which log position its &lt;code&gt;SELECT&lt;/code&gt; 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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot/fig7-bracket-cases.png&quot; width=&quot;2000&quot; height=&quot;714&quot; alt=&quot;The three cases inside one bracket. Alice&amp;#x27;s key had no write inside the bracket, so the row is kept and booked at the high watermark. Bob was written after the scan read the row, so the row is stale, and Carol was written before the scan read it, so the row already carries the write. Both rows are dropped either way, and the log gives the value at the high watermark.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;The three cases inside one bracket. Alice&apos;s key had no write inside the bracket, so the row is kept and booked at the high watermark. Bob was written after the scan read the row, so the row is stale, and Carol was written before the scan read it, so the row already carries the write. Both rows are dropped either way, and the log gives the value at the high watermark.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id=&quot;what-is-guaranteed&quot;&gt;What Is Guaranteed&lt;/h2&gt;
&lt;p&gt;To be precise about what this theorem guarantees, the boundaries must be clear:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We are backfilling keys that are &lt;strong&gt;in scope&lt;/strong&gt;, not a whole-table transactional snapshot. (Whole-table is a separate, harder result.)&lt;/li&gt;
&lt;li&gt;It does &lt;strong&gt;not&lt;/strong&gt; claim all the reads happened at one moment. They didn’t. The equivalence is about the output, &lt;em&gt;despite&lt;/em&gt; the scattered reads.&lt;/li&gt;
&lt;li&gt;The frontier moves &lt;strong&gt;forward&lt;/strong&gt;: we reproduce a point our scan reaches, not an arbitrary instant in the past.&lt;/li&gt;
&lt;li&gt;It says &lt;strong&gt;nothing about the sink.&lt;/strong&gt; Whether a particular sink applies the stream faithfully is a separate contract that is out of scope.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The formal equality holds under four explicit conditions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;the chunks &lt;strong&gt;partition&lt;/strong&gt; &lt;code&gt;K&lt;/code&gt;, so every in-scope key belongs to exactly one chunk&lt;/li&gt;
&lt;li&gt;every key in &lt;code&gt;K&lt;/code&gt; gets a refresh from its chunk, recording the key’s value or absence at that chunk’s log position&lt;/li&gt;
&lt;li&gt;every read position is &lt;strong&gt;at or before&lt;/strong&gt; &lt;code&gt;f&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;the log &lt;strong&gt;faithfully carries&lt;/strong&gt; every change to each key between its read and &lt;code&gt;f&lt;/code&gt;, in commit order&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Under those conditions the equality is exact:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;replay output ↾ K  =  database state at f ↾ K
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We replay what DBLog emitted and look only at our scope keys. We get exactly the database’s state at the single frontier &lt;code&gt;f&lt;/code&gt; on those same keys. (In the paper: &lt;code&gt;apply(prefix(R)) ↾ K = src(b₀, H, f) ↾ K&lt;/code&gt;.) That is the core result, machine-checked in Isabelle/HOL.&lt;/p&gt;
&lt;h2 id=&quot;the-virtual-cut&quot;&gt;The Virtual Cut&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;In the paper (&lt;a href=&quot;https://arxiv.org/abs/2605.31475&quot;&gt;arXiv:2605.31475&lt;/a&gt;), we name this construct a &lt;strong&gt;virtual cut&lt;/strong&gt; and it is a property of the output stream DBLog emits.&lt;/p&gt;
&lt;p&gt;This is the core idea of the paper.&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/snapshot-equivalent-replay-of-a-live-table-without-taking-a-full-snapshot/fig5_physical_vs_virtual_v8.png&quot; width=&quot;2000&quot; height=&quot;651&quot; alt=&quot;Physical cut versus virtual cut. A physical cut reads every key at one log position, which DBLog never does. A virtual cut reads the chunks at different positions and still matches the database at one position, which is what DBLog&amp;#x27;s output gives.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;Physical cut versus virtual cut. A physical cut reads every key at one log position, which DBLog never does. A virtual cut reads the chunks at different positions and still matches the database at one position, which is what DBLog&apos;s output gives.&lt;/figcaption&gt;
&lt;/figure&gt;</content:encoded><category>CDC</category><category>Change-Data-Capture</category><category>DBLog</category><category>Debezium</category><category>NetflixEngineering</category></item><item><title>I Vibe Coded My Old Netflix Project</title><link>https://aandreakis.com/posts/i-vibe-coded-my-old-netflix-project</link><guid isPermaLink="true">https://aandreakis.com/posts/i-vibe-coded-my-old-netflix-project</guid><description>Rebuilding Netflix’s DBLog CDC engine in Java using AI coding agents from public specs—lessons on contracts, tests, and reviews.</description><pubDate>Fri, 15 May 2026 09:29:00 GMT</pubDate><content:encoded>&lt;p&gt;Just published a DBLog implementation, 100% vibe coded. Literally didn’t touch a single file. It is pretty clear that infra/platform/backend coders are cooked if they don’t lean really hard into LLMs.&lt;/p&gt;
&lt;p&gt;Repo: &lt;a href=&quot;https://github.com/aandreakis/dblog-impl&quot;&gt;&lt;strong&gt;github.com/aandreakis/dblog-impl&lt;/strong&gt;&lt;/a&gt; · &lt;a href=&quot;https://aandreakis.com/dblog-impl&quot;&gt;&lt;strong&gt;Overview &amp;#x26; architecture&lt;/strong&gt;&lt;/a&gt; · &lt;a href=&quot;https://aandreakis.com/dblog-impl/ops/tap-tui/docs&quot;&gt;&lt;strong&gt;Hydroscope TUI docs&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://aandreakis.com/dblog&quot;&gt;DBLog&lt;/a&gt; is the watermark-based CDC algorithm that I developed while I was at Netflix. If you are not familiar: DBLog not only captures changes from a source database as they occur, it can also capture the current state without stalling writes or the change event flow. The following TUI animation illustrates this (part of the repo and generated with the snap of a finger):&lt;/p&gt;
&lt;figure class=&quot;attachment&quot;&gt;
  &lt;img src=&quot;https://aandreakis.com/images/posts/i-vibe-coded-my-old-netflix-project/hero-linkedin-1200-og.jpg&quot; width=&quot;1200&quot; height=&quot;702&quot; alt=&quot;DBLog at work: the watermark algorithm merging CDC events with chunk reads into one clean ordered stream. Shown in the Hydroscope TUI.&quot; /&gt;
  &lt;figcaption class=&quot;attachment__caption&quot;&gt;DBLog at work: the watermark algorithm merging CDC events with chunk reads into one clean ordered stream. Shown in the Hydroscope TUI.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;I thought it was worth having an implementation from someone who was part of the original work, especially as the DBLog mechanism has been adopted by &lt;a href=&quot;https://debezium.io/blog/2021/10/07/incremental-snapshots/&quot;&gt;&lt;strong&gt;Debezium&lt;/strong&gt;&lt;/a&gt;, &lt;a href=&quot;https://nightlies.apache.org/flink/flink-cdc-docs-release-3.6/docs/connectors/flink-sources/mysql-cdc/#how-incremental-snapshot-reading-works&quot;&gt;&lt;strong&gt;Apache Flink CDC&lt;/strong&gt;&lt;/a&gt;, and other projects.&lt;/p&gt;
&lt;p&gt;For this work I only used the public &lt;a href=&quot;https://arxiv.org/abs/2010.12597&quot;&gt;&lt;strong&gt;paper&lt;/strong&gt;&lt;/a&gt; and &lt;a href=&quot;https://netflixtechblog.com/dblog-a-generic-change-data-capture-framework-69351fb9099b&quot;&gt;&lt;strong&gt;blog post&lt;/strong&gt;&lt;/a&gt; as source material. There is no feature roadmap and no support commitment. This repo only exists to promote the DBLog idea, to verify, study, and experiment with it.&lt;/p&gt;
&lt;p&gt;The AI part though, is what I wanted to test the most. Could I take something I know deeply, point coding agents to public material, and have them produce code I would be comfortable releasing ?&lt;/p&gt;
&lt;p&gt;The answer is yes and Im honestly stoked by the result. Lets say it this way: I have more confidence in this implementation than I had in early iterations of the code that I deployed at Netflix. The coding agents rigorously self-tested the code, identified and fixed several corner cases one would typically only encounter in the wild. Such as MySQL/PostgreSQL replication quirks, datatype boundaries, cross-version compatibility issues, and small memory leaks that compound over time.&lt;/p&gt;
&lt;p&gt;It was a bit harder however than a simple “build DBLog from this blog post and paper” and I iterated a few times until I found a structure that worked well. I learned a lot during this process and it would take me much less time if I repeated this now.&lt;/p&gt;
&lt;p&gt;The workflow that ended up working well looks like this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use ChatGPT Pro to extract a high-level implementation spec from the public material&lt;/li&gt;
&lt;li&gt;Ask for a module-by-module implementation plan with goals and success criteria&lt;/li&gt;
&lt;li&gt;Use Codex and Claude Opus to implement, both with max effort&lt;/li&gt;
&lt;li&gt;Execute several self-review and deploy-and-test runs: make the agents deploy it, run it under a variety of scenarios, and try to break things&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;LLMs are now pretty good at coding, especially compared to anything before GPT-5.4. Yet, the defaults are still not great. If you care about clean, idiomatic code, you have to say exactly what that means. Generally, you have to define what you want and what you DON’T want. Im surprised that neither Codex nor Claude does a better job here. It helped pointing the models at principles from Effective Java and Clean Code. Instructing the agents to write TDD-style failing tests first also worked well, and high test coverage seems to be a good strategy to prevent drift.&lt;/p&gt;
&lt;p&gt;Before this project, I used LLMs only for very specific local tasks (like reviews etc) and I was unsure how it would feel if I stopped coding. I was worried that it would feel less stimulating.&lt;/p&gt;
&lt;p&gt;After working with Claude and Codex every day now, basically every moment Im awake, I can confidently say that it is unlike anything I imagined. It is extremely satisfying.&lt;/p&gt;
&lt;p&gt;The bigger realization is that once you accept handing implementation to coding agents, the next instinct is to carefully review everything they generate. But with the throughput that coding agents offer, line-by-line reviews kill most of the possible velocity gain. The new review surface increasingly feels like “let me define the contract, tests, invariants, failure modes, and convergence criteria.” Plus asking the AI to showcase some snippets of important code, just to make sure it looks ok. I’m still working through this myself, and trying to find the right balance between inspecting generated code and trusting the higher-level contracts, tests, and review loops.&lt;/p&gt;
&lt;p&gt;We vibe code maxing now and there is no going back from this.&lt;/p&gt;
&lt;p&gt;Working pretty hard on multiple fronts and something related to DBLog too :))&lt;/p&gt;
&lt;p&gt;Disclaimer: The repo is not Netflix’s production DBLog. No Netflix production code was used. No private material was used. This repo is not affiliated with, endorsed by, or maintained by Netflix.&lt;/p&gt;
&lt;p&gt;Also: The repo is not recommended for production use. Use a well maintained and active CDC project like &lt;a href=&quot;https://debezium.io/&quot;&gt;&lt;strong&gt;Debezium&lt;/strong&gt;&lt;/a&gt; instead.&lt;/p&gt;</content:encoded><category>CDC</category><category>Change-Data-Capture</category><category>ChatGPT</category><category>Claude</category><category>Codex</category><category>DBLog</category><category>Debezium</category><category>NetflixEngineering</category><category>VibeCoding</category></item></channel></rss>