Skip to content

Add ordered fixed-partition native CDC streams - #14116

Merged
tclinkenbeard-oai merged 8 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/cdc-stack-5-ordered-streams
Sep 24, 2026
Merged

tclinkenbeard-oai merged 8 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/cdc-stack-5-ordered-streams

Conversation

@tclinkenbeard-oai

Copy link
Copy Markdown
Collaborator

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_overloaded when 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 main while preserving the previous draft's implementation and test changes.

Validation on the merged revision (Linux, Clang):

  • Built fdbclient_test, fdbserver_core_test, fdbserver_cdcproxy_test, and fdbserver.
  • Passed all 71 focused /NativeCDC/ unit tests (13 client, 6 core, 52 proxy).
  • Passed NativeCdcOrdered and NativeCdcOrderedBufferBackpressure simulations with buggify disabled.
  • Passed git diff --check and 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.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

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.
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-ide on Linux RHEL 9

  • Commit ID: 7e01e7a
  • Duration 0:21:41
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@tclinkenbeard-oai tclinkenbeard-oai added CDC Relates to the FDB native CDC feature 8.0 PRs we want to include in 8.0 before we branch/release. labels Sep 23, 2026

@tclinkenbeard-oai tclinkenbeard-oai left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  1. 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.
  2. 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.
  3. Wait for the complete version. The merger uses the slowest partition’s progress. In the example, it waits for both a and z. Whole-group size checks prevent returning half a version; oversized groups fail explicitly.
  4. Replay consistently after interruption. Reinitialization resets every partition to the common durable acknowledgement. Previously returned, unacknowledged changes can repeat, so applications must handle replay.
  5. 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.

@tclinkenbeard-oai
tclinkenbeard-oai marked this pull request as ready for review September 23, 2026 22:43
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux RHEL 9

  • Commit ID: 7e01e7a
  • Duration 0:51:03
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: 7e01e7a
  • Duration 0:53:41
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: 7e01e7a
  • Duration 1:08:04
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux RHEL 9

  • Commit ID: 7e01e7a
  • Duration 1:44:22
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS 14.x

  • Commit ID: 7e01e7a
  • Duration 3:05:47
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@tclinkenbeard-oai
tclinkenbeard-oai merged commit 9a293a2 into apple:main Sep 24, 2026
9 of 10 checks passed
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS 14.x

  • Commit ID: 7e01e7a
  • Duration 2:53:01
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.0 PRs we want to include in 8.0 before we branch/release. CDC Relates to the FDB native CDC feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants