liveBook · Manning

CDC

As explained in Grokking Software Architecture

Change data capture is a technique for detecting and recording changes made to data stores so those changes can be propagated or processed.

When a legacy system is being replaced, its new counterpart needs the same data without asking the old application to write to both databases. Change data capture (CDC) reads the legacy database’s transaction log and streams changes as events, letting the replacement build a synchronized copy. section 12.5.2

A reliable migration pairs two phases:

  • Snapshot: copy historical data from the old database to the new one, using a tool such as pg_dump or AWS DMS. section 12.5.2
  • Stream: capture and replay changes made while the snapshot is underway, until both databases are synchronized. section 12.5.2

Skipping the snapshot is risky: databases can compress, roll over, or purge old transaction logs. CDC is a non-invasive alternative to application-level syncing; Debezium, built on Apache Kafka, is one named tool. section 12.5.2 section 12.5.2

Figure 12.4 The Strangler Fig Migration. Instead of a risky "Big Bang" rewrite, an API Gateway incrementally reroutes traffic to the new Microservice, while Change Data Capture (CDC) safely syncs the underlying data in the background.

Shows CDC syncing data in the background as an API Gateway incrementally routes traffic to a replacement service. section 12.5.2

How Grokking Software Architecture covers it

How deep it goes
Defines transaction-log capture and explains snapshot-plus-stream synchronization, while warning against relying on deltas alone.
Examples
Uses a billing-service extraction, a historical-data snapshot, and streaming changes; names pg_dump, AWS DMS, and Debezium.
What you can do after
Apply CDC to synchronize a replacement database by streaming changes from a legacy database after a snapshot.
How it connects
Connects to Strangler Fig migration, database transaction logs, snapshots, and application-level syncing.

Also explained in

Compare how 6 books explain CDC →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.