Self-Assessment Quiz: Change Data Capture

Twenty questions. Aim for 16 or more. On the streaming path, treat 18 as the bar.


Question 1

CDC works by:

  • A. Polling tables with a watermark
  • B. Reading the log the database was already writing for crash recovery
  • C. Comparing snapshots
  • D. Installing triggers

Question 2

Logical decoding is needed because the write-ahead log is, by default:

  • A. Encrypted
  • B. Compressed
  • C. Physical — "page 4,182 byte 96 changed," not "customer 8841's region became Oregon"
  • D. Truncated

Question 3

Which problem does CDC solve that is described as requiring nothing from the source team?

  • A. Watermark accuracy
  • B. Deletes
  • C. Reducing source load
  • D. Schema evolution

Question 4

A row transitioning through four statuses between hourly polls yields:

  • A. One row to batch, one event to CDC
  • B. One row to batch, four events to CDC
  • C. Four rows to batch, four events to CDC
  • D. Four rows to batch, one event to CDC

Question 5

Which Kestrel table does the chapter say should stay on batch full loads?

  • A. orders
  • B. order_items
  • C. products
  • D. inventory

Question 6

Trigger-based CDC's main cost is:

  • A. It cannot see deletes
  • B. It doubles the write cost of the source table
  • C. It requires replication privileges
  • D. It is not ordered

Question 7

The Debezium deduplication key should be:

  • A. ts_ms
  • B. source.ts_ms
  • C. source.lsn
  • D. The Kafka offset

Question 8

source.ts_ms versus the top-level ts_ms is the distinction between:

  • A. Milliseconds and microseconds
  • B. Event time and processing time
  • C. Commit time and transaction start
  • D. Source and target clocks

Question 9

With REPLICA IDENTITY DEFAULT, the before image of an update contains:

  • A. The entire old row
  • B. Only the primary key
  • C. Nothing
  • D. Only the changed columns

Question 10

Setting REPLICA IDENTITY FULL on Kestrel's orders increased WAL generation by roughly:

  • A. 3%
  • B. 31%
  • C. 130%
  • D. No measurable change

Question 11

A consistent (non-locking) snapshot's hidden cost is:

  • A. It locks the table
  • B. It holds a long transaction open, preventing vacuum — Chapter 7's bloat problem
  • C. It cannot be resumed
  • D. It misses concurrent changes

Question 12

An incremental snapshot is preferred for large tables because:

  • A. It is faster
  • B. It is resumable and has bounded source impact, even though it is ~75% slower
  • C. It requires no privileges
  • D. It produces smaller output

Question 13

A replication slot with a stopped consumer causes:

  • A. Data loss
  • B. WAL to accumulate without bound until the disk fills and the primary stops accepting writes
  • C. The connector to fail over
  • D. Nothing, until the connector restarts

Question 14

Which control fires at the moment of the crash rather than when the disk is filling?

  • A. max_slot_wal_keep_size
  • B. The retained-WAL monitor
  • C. The alert on active = false
  • D. Dropping unused slots

Question 15

max_slot_wal_keep_size trades:

  • A. Performance for durability
  • B. A broken CDC stream for a protected disk
  • C. Latency for throughput
  • D. Nothing — it is free

Question 16

Kafka guarantees ordering:

  • A. Across the whole topic
  • B. Within a partition — so per row, since Debezium keys by primary key
  • C. Within a source transaction
  • D. By timestamp

Question 17

Debezium emits a tombstone after a delete in order to:

  • A. Confirm the delete
  • B. Let Kafka log compaction remove the key entirely
  • C. Trigger downstream alerts
  • D. Record the before image

Question 18

Which makes §14.8's merge idempotent?

  • A. ROW_NUMBER() ORDER BY lsn DESC
  • B. WHEN MATCHED AND s.lsn > t.source_lsn
  • C. The op = 'd' branch
  • D. The WHEN NOT MATCHED clause

Question 19

heartbeat.action.query exists to prevent:

  • A. Connector timeouts
  • B. A connector on a low-volume table filling the disk of a high-volume database
  • C. Duplicate events
  • D. Snapshot failures

Question 20

errors.tolerance: none is set because:

  • A. It improves throughput
  • B. Skipping an unconvertible record is silent data loss
  • C. It is required by Kafka Connect
  • D. It reduces log volume

Answer Key

1. B — §14.1. CDC is not an extra thing the database does for you; it is a different reader of something it was already writing.

2. C — §14.1. Hence wal_level = logical, set in Chapter 5 because changing it requires a restart.

3. B — §14.2. Which matters because Chapter 13's second case study shows soft-delete requests have a refusal rate, often for good reasons.

4. B — §14.2. And for a status funnel or an SCD2 dimension, the intermediate states are the data.

5. C — §14.2, 📐 callout. 47,000 rows, a 12-second full load. CDC would add connectors, slots, and snapshots for nothing.

6. B — §14.3. A write per write, which is why it is a fallback rather than a choice.

7. C — §14.7. Two changes can share a millisecond; they cannot share an LSN.

8. B — §14.4. Chapter 4 §4.6's distinction, in one message. Use source.ts_ms for anything analytical.

9. B — §14.4, ⚠️ callout. The most common Debezium misconfiguration, and its symptom is not an error — it is a downstream model that quietly produces nothing.

10. B — §14.4. Which is why the decision is per table: FULL where you need before-images, DEFAULT elsewhere.

11. B — §14.5. The mechanism that took down checkout in Chapter 7's Case Study 1.

12. B — §14.5, 📏 callout. Restartability and bounded impact beat speed when the alternative restarts from scratch on a 40-minute table.

13. B — §14.6. The worst outcome in this book, caused by a data pipeline component.

14. C — §14.6. The highest-value alert in the chapter.

15. B — §14.6. A broken pipeline is bad; an outage is worse. Make the trade deliberately.

16. B — §14.7. Changes to different rows are not ordered relative to each other, even within one source transaction.

17. B — §14.7. A compacted topic retains the latest message per key; a null value removes the key. Naive consumers null-pointer on it.

18. B — §14.8. Replaying an old event cannot overwrite a newer state.

19. B — §14.11. The slot only advances when the connector confirms a position, and it confirms based on messages it receives — so a quiet captured table means the slot never advances past WAL generated by other tables.

20. B — §14.11. Chapter 2's fail-loudly principle. Fail, and handle it.


Topic map

Missed Reread
1, 2 §14.1 — what the log contains
3, 4, 5 §14.2 — what CDC solves
6 §14.3 — the three kinds
7, 8, 9, 10 §14.4 — the envelope and REPLICA IDENTITY
11, 12 §14.5 — the initial snapshot
13, 14, 15 §14.6 — operating a slot
16, 17 §14.7 — consuming
18 §14.8 — stream to table
19, 20 §14.11 — the settings that prevent incidents