# CDC Nuances & Errata

> Pre-flight checks before you promise exactly-once or zero data loss: corrections and sharp edges on snapshots, tombstones, schema changes, and sinks.

Canonical page: <https://sandgraal.github.io/letstalkcdc/errata/>

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

Delivery Caveats Snapshot + Replay Notes

A living list of precise clarifications, corrections, and “gotchas”. Corrections follow the process in the [methodology](https://sandgraal.github.io/letstalkcdc/methodology/#corrections); to report one, see the [contact page](https://sandgraal.github.io/letstalkcdc/contact/#content-error); for a live incident start with the [first-15-minutes playbook](https://sandgraal.github.io/letstalkcdc/troubleshooting/). 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](https://sandgraal.github.io/letstalkcdc/exactly-once/#per-hop), and [Is CDC exactly-once? Per hop](https://sandgraal.github.io/letstalkcdc/is-cdc-exactly-once/) 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;
```

[compose.yaml](https://sandgraal.github.io/letstalkcdc/downloads/compose.yaml) [postgres sample connector](https://sandgraal.github.io/letstalkcdc/downloads/postgres-inventory.json) [register connector script](https://sandgraal.github.io/letstalkcdc/downloads/register_connector.sh)

---

CDC: The Missing Manual by Christopher Ennis (Let's Talk CDC), licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Attribution is required.
