Repository navigation
Add ordered fixed-partition native CDC streams - #14116
tclinkenbeard-oai merged 8 commits into
Conversation
…tclinkenbeard/cdc-stack-5-ordered-streams
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Owner replacement can rewind ordered consumers to their common durable acknowledgement while the workload is draining. Validate each reply above that floor, verify replayed payloads, and apply each complete version once. Check the expected history through each delivered cursor so gaps still fail.
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
tclinkenbeard-oai
left a comment
There was a problem hiding this comment.
Generated by Codex.
What problem is this PR trying to solve? (ELI10)
CDC is the feed an application reads to copy database changes elsewhere. An existing stream reads through one assigned proxy. Splitting the work into separate streams leaves the application responsible for combining them correctly.
Illustrative example: one database commit changes keys a and z. We want different workers to read those key ranges, while still giving the application both changes together—even when one worker is slower.
How does this PR solve the problem? (ELI10 and review walkthrough)
It divides one named stream into fixed key-range partitions, then combines their results behind one cursor and one acknowledgement.
- Create the stream together. Registration writes the partitions, parent mapping, and initial retention positions in one transaction. There cannot be a successfully registered half-group.
- Read partitions concurrently. The consumer starts reads for partitions that need more data. Each reply certifies how far that partition has read, including gaps without mutations.
- Wait for the complete version. The merger uses the slowest partition’s progress. In the example, it waits for both
aandz. Whole-group size checks prevent returning half a version; oversized groups fail explicitly. - Replay consistently after interruption. Reinitialization resets every partition to the common durable acknowledgement. Previously returned, unacknowledged changes can repeat, so applications must handle replay.
- Release history together. Acknowledgement advances every child’s retention position atomically. Removal records tag-cleanup obligations and deletes the group in one transaction.
What is it trying to do?
Add ordered, fixed-partition native CDC through the C and Python APIs, preserving complete commit-version groups, a scalar cursor, common durable acknowledgement, and bounded buffering.
Is it correct?
Code inspection supports the design. I checked partition geometry, durable codecs, atomic registration/acknowledgement/removal, merge completeness and arena ownership, cancellation and owner replacement, proxy backpressure, API forwarding, and regression assertions. Durable metadata has an explicit schema; transient interface changes have compatibility coverage.
Reviewed head 7e01e7a83991d5d68e23e6b7f094a2a534a54117 against base adccd140d967efe772885d0ba28062078cee18a0; both remained unchanged. Current-head Windows Boost, formatting, clang-tidy, and clang-IDE checks passed; six other checks remain pending. No current-head failure is reported.
No builds, tests, or simulations were run for this review.
Are there bugs?
I did not find any correctness bugs.
Are there omissions?
Nonblocking coverage gap: the workload’s cancellation scenario interrupts consumption. It does not specifically interrupt acknowledgement between its durable update and proxy notifications. Extending that fixture to exercise both sides of the commit boundary would protect the common-watermark and resume guarantees. The current reconciliation code appears sound.
Are there better ways of doing things?
No redesign needed. The merger does work proportional to partition count × emitted version groups, plus mutations. With at most 64 partitions, the straightforward implementation is reasonable; throughput claims still need measurements.
Should this CL be LGTMd?
Yes, LGTM from source inspection. The inspected ordering, ownership, and retention invariants hold. The highest remaining risk is interrupted acknowledgement interacting with recovery and unacknowledged read-ahead; the coverage gap above would strengthen confidence. Pending CI is not a demonstrated correctness failure.
Result of foundationdb-pr-clang-arm on Linux RHEL 9
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Result of foundationdb-pr-macos-m1 on macOS 14.x
|
Result of foundationdb-pr-macos on macOS 14.x
|
Add ordered native CDC streams over fixed key-range partitions. The client reads partitions concurrently and returns complete commit-version groups through one logical cursor and common durable acknowledgement. Registration and removal are atomic; bounded merging returns
server_overloadedwhen a complete group or retained proxy buffers prevent progress.Expose ordered registration through the C and Python APIs, reuse the existing consume/resume/acknowledge interfaces, and show logical parents and physical partitions in CDC status. Ordered registration requires every published CDC proxy to advertise support. Partition boundaries remain fixed, and live retagging remains opt-in.
Part 5 of the split of #13935, following the merged #14114. Supersedes tclinkenbeard-oai/foundationdb#7. Merged current
mainwhile preserving the previous draft's implementation and test changes.Validation on the merged revision (Linux, Clang):
fdbclient_test,fdbserver_core_test,fdbserver_cdcproxy_test, andfdbserver./NativeCDC/unit tests (13 client, 6 core, 52 proxy).NativeCdcOrderedandNativeCdcOrderedBufferBackpressuresimulations with buggify disabled.git diff --checkand Python syntax checks.Previous draft validation reported 77 focused unit tests, four simulations, and C/Python API tests passing. Those API tests have not yet been rerun on this merged revision.