Advanced

CDC Nuances & Errata

Bookmark the gotchas: delivery guarantees, snapshots, and backfills all hide sharp edges. Use this checklist before declaring “exactly once.”

A living list of precise clarifications, corrections, and “gotchas”. Corrections follow the process in the methodology; to report one, see the contact page; for a live incident start with the first-15-minutes playbook. Treat this as pre‑flight checks before promising exactly‑once or “zero data loss.”

End‑to‑end exactly‑once vs. effectively‑once

  • Source connectors are at‑least‑once by default. Kafka Connect has an opt‑in exactly‑once mode for source connectors (Debezium documents it from 3.3), but it covers only the hop into Kafka and comes with open caveats; see exactly‑once, hop by hop, and Is CDC exactly-once? Per hop for how to scope a vendor's claim. Either way, achieve effectively‑once at the sink by making it idempotent (UPSERT on stable keys, ordered by log position) and/or deduplicating using a durable event_id ledger.
  • Transaction boundaries: Database transactions map to change streams, not to sink transactions unless your pipeline coordinates them. Don’t assume cross‑topic atomicity.
  • Per‑key ordering only: Ordering is guaranteed per partition key (primary/business key). Cross‑entity ordering is not guaranteed and shouldn’t be relied upon.

Snapshots, backfills, and replays

  • Initial snapshots can interleave with live changes; design consumers to reconcile by log position: key the sink on the primary key and apply a change only if its source log position (LSN, SCN or binlog position) is greater than the one stored. Do not use op_ts, ts_ms or any other timestamp as the version; timestamps tie and can run backwards.
  • Incremental snapshots (signal‑based) are powerful but can produce duplicates; always merge on the primary key and the highest log position, and keep idempotent sinks.
  • Backfills are just another snapshot; isolate them (topics/headers) to avoid double‑counting.

Tombstones, compaction, and deletions

  • Tombstones are required for compaction to fully remove keys; keep a non‑zero delete.retention.ms long enough for consumers.
  • Soft‑delete models (a delete marker plus the delete’s log position) are what stop a replayed older change resurrecting a row. They need a retention and cleanup policy so markers do not pile up, and a marker must not be purged while older events can still be replayed.

Schema evolution

  • Always version payload schemas and keep consumers tolerant to additive changes. No producer should introduce breaking field removals/renames without a migration window.
  • Use optional + default values judiciously to avoid “poison” events.

Operational guardrails

  • Watch lag/throughput and max.queue.size, max.batch.size, poll.interval.ms. Oversizing queue without heap tuning yields GC stalls.
  • Alert on connector task failures, restart loops, and earliest‑offset resets.
  • Prefer per‑table connectors for isolation when SLAs differ; otherwise group by SLA and update cadence.

Recommended dedup ledger

-- event_id is a stable UUID in headers or payload
create table if not exists dw.processed_event(
  event_id text primary key,
  processed_at timestamptz not null default now()
);

On ingest:

insert into dw.processed_event(event_id)
values (:event_id)
on conflict do nothing;
Progress 0% No progress yet
Progress is stored locally in this browser.