Skip to content

Conversation

@jkni
Copy link

@jkni jkni commented Oct 8, 2025

What is the issue

Repairs use the local write path for streams on CDC-enabled tables, based on table schema. This interacts poorly with the separation of CNDB services.

What does this PR fix and why was it fixed

Only use the CDC write path for a stream if CDC is enabled in the node's configuration (as well as in the schema). This avoids attempting to use the local write path if commitlog-based CDC is not enabled.

@jkni jkni requested a review from maxtomassi October 8, 2025 22:23
@jkni jkni self-assigned this Oct 8, 2025
@github-actions
Copy link

github-actions bot commented Oct 8, 2025

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@jkni
Copy link
Author

jkni commented Oct 9, 2025

Low test coverage is because we don't run the test suite with CDC enabled on PRs. I ran the test suite with CDC enabled and saw no additional failures.

Copy link

@maxtomassi maxtomassi left a comment

Choose a reason for hiding this comment

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

The change looks good to me. On the CNDB side we never enable CDC at the DatabaseDescriptor level, so the write path will not be triggered for cross-region repairs in Astra.

@sbtourist
Copy link

@maxtomassi @jkni As a side note, @jtgrabowski rightful concern about merging this without passing the quality gate (see Slack discussion) made me realize C* doesn't seem to have any kind of contract between DatabaseDescriptor#isCDCEnabled and the cdc schema property (well, not a clear one I could find at least); practically speaking, this means to me that there's no guarantee something will not break in the wild in case of the - admittedly odd but possible - configuration combination of DatabaseDescriptor#isCDCEnabled = false and cdc = true. Thoughts?

@maxtomassi
Copy link

maxtomassi commented Oct 9, 2025

As mentioned in Slack, the only relationship I see between the two properties are in here:

// Only add CDC-enabled flag to schema if it's enabled on the node. This is to work around RTE's post-8099 if a 3.8+
// node sends table schema to a < 3.8 versioned node with an unknown column.
if (DatabaseDescriptor.isCDCEnabled())
builder.add("cdc", params.cdc);

Which seems to apply when a new table is created and when a table is altered. This means the cdc param will not be considered for tables in the schema keyspace if CDC is not enabled in the database descriptor.

…airs

Repairs on CDC-enabled tables use the local write
path when the stream is received on a CDC-enabled
node. There is no existing test coverage of this
local write path. This commit parameterizes this
existing test to run end-to-end repairs for every
combination of node-enabled/table-enabled,
adding assertions to cover which stream path is
used.
@jkni jkni requested a review from maxtomassi October 9, 2025 19:17
Copy link

@maxtomassi maxtomassi left a comment

Choose a reason for hiding this comment

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

The test looks good to me, thanks for coming up with a way to cover the changes :)

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 9, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@jkni jkni requested a review from sbtourist October 9, 2025 21:42
@jkni
Copy link
Author

jkni commented Oct 9, 2025

As discussed with Max, pinging Sergio for any further thoughts. Max can pick this up and merge if any issues are resolved before I'm online tomorrow.

@cassci-bot
Copy link

✔️ Build ds-cassandra-pr-gate/PR-2043 approved by Butler


Approved by Butler
See build details here

Copy link

@sbtourist sbtourist left a comment

Choose a reason for hiding this comment

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

The new test looks great, thanks everyone!

@sbtourist
Copy link

sbtourist commented Oct 10, 2025

To close the loop on #2043 (comment), we verified that even if CassandraStreamReceiver goes through the write path due to CDC being enabled on the schema, if CDC is not enabled on the DD, the node will produce no CDC logs; it follows that checking for DD#isCDCEnabled upfront in the receiver would yield the same end result (no CDC logs being produced). IOW, this change is backward compatible.

@maxtomassi maxtomassi merged commit 8277624 into main Oct 10, 2025
489 of 493 checks passed
@maxtomassi maxtomassi deleted the CNDB-15623 branch October 10, 2025 09:57
maxtomassi pushed a commit that referenced this pull request Oct 10, 2025
…iver if CDC is enabled on the node (#2043)

Repairs use the local write path for streams on CDC-enabled tables,
based on table schema. This interacts poorly with the separation of CNDB
services.

This commit fixes the issue by only using the CDC write path for a stream if CDC 
is enabled in the node's configuration (as well as in the schema). This avoids 
attempting to use the local write path if commitlog-based CDC is not enabled.
maxtomassi added a commit that referenced this pull request Oct 10, 2025
…iver if CDC is enabled on the node (#2043)

Repairs use the local write path for streams on CDC-enabled tables,
based on table schema. This interacts poorly with the separation of CNDB
services.

This commit fixes the issue by only using the CDC write path for a stream if CDC 
is enabled in the node's configuration (as well as in the schema). This avoids 
attempting to use the local write path if commitlog-based CDC is not enabled.
michaelsembwever pushed a commit that referenced this pull request Oct 20, 2025
…raStreamReceiver if CDC is enabled on the node (#2043)

Repairs use the local write path for streams on CDC-enabled tables,
based on table schema. This interacts poorly with the separation of CNDB
services.

This commit fixes the issue by only using the CDC write path for a stream if CDC
is enabled in the node's configuration (as well as in the schema). This avoids
attempting to use the local write path if commitlog-based CDC is not enabled.
jkni added a commit that referenced this pull request Oct 23, 2025
…iver if CDC is enabled on the node (#2043)

Repairs use the local write path for streams on CDC-enabled tables,
based on table schema. This interacts poorly with the separation of CNDB
services.

This commit fixes the issue by only using the CDC write path for a stream if CDC 
is enabled in the node's configuration (as well as in the schema). This avoids 
attempting to use the local write path if commitlog-based CDC is not enabled.
eolivelli pushed a commit that referenced this pull request Oct 23, 2025
…iver if CDC is enabled on the node (backport #2043) (#2086)

### What is the issue
#2043 was committed to main and needs to be backported to
cndb-main-release-202510.

### What does this PR fix and why was it fixed
Cherry-picks the merge of #2043. No changes to the contents of the patch
were needed.
michaelsembwever pushed a commit that referenced this pull request Oct 25, 2025
…raStreamReceiver if CDC is enabled on the node (#2043)

Repairs use the local write path for streams on CDC-enabled tables,
based on table schema. This interacts poorly with the separation of CNDB
services.

This commit fixes the issue by only using the CDC write path for a stream if CDC
is enabled in the node's configuration (as well as in the schema). This avoids
attempting to use the local write path if commitlog-based CDC is not enabled.
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.

5 participants