Implemented project · Personal reference

Resilient Data Pipelines

Replay a synthetic change stream transactionally, reconcile current state and keep deletes from reappearing after late arrivals.

Context and requirements

Keep downstream state correct when late or duplicated source changes are unavoidable.

A source key and monotonic version are required. Duplicate versions with conflicting payloads abort the batch.

Architecture

  1. Versioned input
  2. Atomic SQLite upsert
  3. Retained tombstones
  4. Reconciled snapshot

Alternatives and implementation

Snapshot replacement is simpler for small sources. An event log allows selective replay and delete history.

Download executable Python reference · Download test suite · License

Save the Python lab sources from the project directory inside a folder named labs. From its parent, run python3 -m labs.cdc_replay. To run the shared suite, place test_labs.py next to the folder and run python3 -m unittest test_labs.

Security, cost and operations

Query only live rows, minimize retained payloads and reconcile keys after replay. Track rejected batches, lag and row deltas.

Results and lessons

The local tests cover duplicate input, late arrivals, deletion and atomic failure. SQLite demonstrates the state transitions on one process.

Keep tombstones for the full replay horizon. Record key and source-version semantics in the source contract.