Cover CDC checkpoint offsets around fetcher failure
Added five bounded concurrency and recovery scenarios against the shared CDC reader, including restoration into a fresh reader from serialized split state.
apache/seatunnel · #12360
CDC reliability coverage
A deterministic harness now verifies which offsets are checkpointed when fetcher failure, record handoff, and snapshot creation interleave.
Problem
A reported MySQL CDC failure raised concern that a checkpoint might advance past records that had not been handed off before a fetcher error. The shared reader lacked direct regression coverage for failure before handoff, partial delivery, failure during snapshot, and checkpoint-lock contention.
Approach
Builds a reusable test harness around the real IncrementalSourceReader, split fetcher, emitter, checkpoint lock, and serialized split state. It injects failures at controlled boundaries and verifies emitted offsets, buffered records, error propagation, and restored replay behavior.
Impact and scope
- Pins down the checkpoint ownership contract around a production-relevant CDC failure window without changing runtime code or checkpoint formats.
- Verifies that queued candidate positions are not checkpointed as emitted records and that remaining records replay after restoration in the modeled schedules.
- Exercises actual lock contention rather than relying on timing sleeps, reducing the risk of a misleading concurrency regression test.
- Does not resolve the open MySQL EOF incident or prove real binlog, GTID, downstream durability, or complete end-to-end recovery behavior.
Validation
- Five new scenarios cover failure before handoff, partial delivery, failure during snapshot, a healthy queued-record control, and checkpoint-lock exclusion during batch handoff.
- Fourteen focused reader tests, all 102 CDC-base tests, six connector-common tests, formatting, and whitespace checks passed.
- The unit-test matrix passed on Ubuntu and Windows with Java 8 and 11; the final required Build check passed and two reviewers approved the change.
- All four hosted checks passed and the verified merge commit credits Goutam Adwant. The referenced issue remains open pending production checkpoint-state evidence.