Skip to content

Add native CDC operator status and guarded removal - #13926

Merged
tclinkenbeard-oai merged 5 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/cdc-operator-safety
Sep 4, 2026
Merged

tclinkenbeard-oai merged 5 commits into
apple:mainfrom
tclinkenbeard-oai:dev/tclinkenbeard/cdc-operator-safety

Conversation

@tclinkenbeard-oai

Copy link
Copy Markdown
Collaborator

Summary

  • Add fdbcli cdc status [json] to join durable stream identities, ranges,
    acknowledgement watermarks, owners, shared-tag blockers, and retired cleanup.
    Bounded, trusted proxy samples expose buffer pressure and recovery state;
    unavailable samples remain explicit rather than appearing as zero usage.
  • Add cdc remove <NAME> <EXPECTED_STREAM_ID> CONFIRM-DATA-LOSS. The expected
    identity remains fixed across retries, preserving a same-name replacement and
    the existing shared-tag and retired-pop guarantees.
  • Add trace-based removal audit evidence and an operating runbook covering
    stalled consumers, explicit history loss, consistent downstream rebuilds,
    admission-off drain, and the prerequisites for binary rollback.
  • Extend existing lifecycle simulations for stale operator identities, pending
    versus completed cleanup, disabled admission, shared-tag blockers, and status
    RPC bounds. Add CLI status and destructive-argument coverage.

Safety and scope

This does not introduce automatic expiration or change acknowledgement, log
retention, or persisted metadata formats. The proxy status endpoint is additive;
existing serialized interface fields and endpoint offsets remain unchanged.
Status does not treat proxy memory as retained TLog disk, an allowed pop frontier
as physical reclamation, or an old generation as proof that CDC caused a recovery
delay. CLI audit logging must be enabled explicitly with --log.

Validation

  • fdbclient_test -f /NativeCDC/: 4 passed, 0 failed.
  • fdbserver_cdcproxy_test -f /NativeCDC/: 11 passed, 0 failed.
  • Six CDC simulation CTests passed: NativeCdcEndToEnd,
    NativeCdcAssignmentPublication, NativeCdcRetiredSharedTagSnapshot,
    NativeCdcRetiredRecovery, NativeCdcRetiredRecoveryMultiRegion, and the
    two-phase NativeCdcDisableRestart-1 / NativeCdcDisableRestart-2 test.
  • The full single_process_fdbcli_tests suite passed, including the new CDC
    status and removal-argument checks.
  • Changed C++ files pass clang-format 19.1.7 checks; git diff --check passes.
  • Python pre-commit hooks report two existing issues outside the added CDC test:
    a Black formatting hunk in client_threads_per_version_env_ignored and E741
    in the existing clear-range comprehension. Those lines are left unchanged.

Remaining production qualification

This is an operator-safety milestone, not a production-readiness declaration.
Deployment-specific alert thresholds, sustained-load and recovery drills,
physical retention attribution, and mixed-version upgrade/rollback qualification
remain separate work.

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

@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 is it trying to do?

Add native CDC operator tooling: cdc status [json] for durable retention metadata and advisory proxy samples, plus identity-guarded removal requiring explicit data-loss confirmation. It also adds audit traces, operating guidance, and lifecycle coverage without changing retention policy or persisted formats.

Is it correct?

The implementation looks correct by source inspection:

  • Removal safety: the expected stream ID remains fixed across retries. The existing removal transaction rechecks the name-to-ID mapping and atomically records retired-tag cleanup, preserving same-name replacements and shared-tag retention.
  • Status consistency: all seven durable metadata ranges share one transaction read version. Returned names, ranges, and paginated results own their storage. Incomplete metadata cannot produce a positive drained result.
  • RPC safety: the status endpoint is private, preserves existing interface serialization and endpoint offsets, and performs at most 256 stream lookups per request. Sampling failures remain explicit without discarding durable metadata; cancellation propagates.
  • Coverage: the added lifecycle assertions check actual removal outcomes, replacement preservation, shared-tag blockers, pending/completed cleanup, disabled admission, and request-size rejection.

The new RPC records are transient; existing durable encodings are unchanged.

No builds, tests, or simulations were run for this review. Current-head public CI shows four passing checks and six pending, with no failures. Pending checks are not validation passes. PR checks

Are there bugs?

I did not find any correctness bugs.

The review included compatibility boundaries, hot-path cost, async ownership and cancellation, preservation of existing invariants, and whether the added tests can detect their intended failures.

Are there omissions?

Two nonblocking coverage gaps would be useful follow-ups:

  • Degraded status: exercise unavailable proxy samples and incomplete metadata, checking that durable output survives, errors remain explicit, and JSON metadata_drained becomes null.
  • Client batching: exercise more than 256 legitimate stream IDs and verify complete aggregation. The oversized-request test checks server rejection, not successful client-side splitting.

The documentation appropriately leaves sustained-load, recovery, and mixed-version qualification as separate production work.

Are there better ways of doing things?

Reusing the existing identity-specific removal and retention machinery keeps the destructive path narrow. The separation between transactional metadata and advisory samples is appropriate. I would extend the existing tests for the gaps above; no broader redesign appears necessary.

Should this CL be LGTMd?

Yes, LGTM for the stated operator-safety scope. The inspected removal and retention invariants are preserved. The main remaining risk is degraded or large-cardinality status behavior, where direct coverage is thinner. This is not a production-readiness or mixed-version qualification sign-off.

@tclinkenbeard-oai
tclinkenbeard-oai marked this pull request as ready for review August 21, 2026 06:59
@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.

@spraza spraza left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Left a comment in case a hard coded timeout causes simulation noise.

Other than that, change makes a lot of sense. Also code is fully isolated so shouldn't affect anything outside CDC.

Comment thread fdbclient/NativeCdc.cpp Outdated
const size_t end = std::min(streamIds.size(), begin + GetCDCProxyStatusRequest::MAX_STREAMS);
GetCDCProxyStatusRequest request;
request.streamIds.assign(streamIds.begin() + begin, streamIds.begin() + end);
samples.push_back(timeoutError(throwErrorOr(proxy.getStatus.tryGetReply(request)), 2.0));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this 2.0 be a knob? In simulation with clogging and buggify, do you expect any noise?

@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

Copy link
Copy Markdown
Contributor

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

  • Commit ID: a19218b
  • Duration 0:41:13
  • 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-arm on Linux RHEL 9

  • Commit ID: a19218b
  • Duration 0:47:16
  • 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: a19218b
  • Duration 1:12:24
  • 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: a19218b
  • Duration 1:15:46
  • 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: a19218b
  • Duration 1:37:26
  • 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

Copy link
Copy Markdown
Contributor

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

  • Commit ID: a19218b
  • Duration 2:32:05
  • 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 cec0a06 into apple:main Sep 4, 2026
9 of 10 checks passed
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: a19218b
  • Duration 4:12:10
  • Result: ❌ FAILED
  • Error: `Error while executing command: # compatible with bash and zsh
    ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${HOME}/.ssh_key
    -o ServerAliveInterval=9 ec2-user@${MAC_EC2_HOST} "
    set -e -o noclobber
    BUILDNUM=${CODEBUILD_BUILD_NUMBER}
    WAIT_TIME=14400 # 4 hours
    LOCK_STALE=4500 # 75 minutes
    LOCK=/tmp/ci.lock
    "'

macOS stat flags, not linux compatible

lock_mtime() { stat -f %m $LOCK || echo 0 }
I=0
while ! (echo $BUILDNUM >$LOCK) 2>/dev/null ; do
if (( ++I >= WAIT_TIME )); then
echo "timeout waiting for ci.lock after $I seconds"
exit 1
fi
if (( $(date +%s) - $(lock_mtime) >= LOCK_STALE )); then
echo "lock expired after $LOCK_STALE seconds ..."
# racy but sleep so chances are low
sleep $(( 3 + RANDOM % 8 ))
if (( $(date +%s) - $(lock_mtime) >= LOCK_STALE )); then
echo "lock holder is gone"
rm -f $LOCK
else
echo "new lock holder"
fi
fi
sleep 1
done
echo "acquired ci.lock"
'
. Reason: exit status 1`

  • 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants