Skip to content

Conversation

pkolaczk
Copy link

We should not take the quick path and compare rowIds
between keys with no clustering, because rowIds may
differ for the keys within the same partition.

michaeljmarshall and others added 2 commits September 29, 2025 14:55
We should not take the quick path and compare rowIds
between keys with no clustering, because rowIds may
differ for the keys within the same partition.
Copy link

Checklist before you submit for review

  • 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

// This optimisation is valid only when both primary keys have clustering components.
// We must not compare by rowId when the clustering is empty, because two keys
// from the same partition may have different rowIds, yet they should be considered equal in that case.
if (o instanceof PrimaryKeyWithSource && !hasEmptyClustering() && !o.hasEmptyClustering())

Choose a reason for hiding this comment

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

do we have unit tests about this class PrimaryKeyWithSource ?

if we have no tests I think that we should add them, so that we can seal this behavior and prevent regressions

Copy link
Author

Choose a reason for hiding this comment

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

Good idea to add them, yes, I'll do

Copy link

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-2027 rejected by Butler


5 regressions found
See build details here


Found 5 new test failures

Test Explanation Runs Upstream
o.a.c.db.counters.CounterLockManagerTest.testInterruptedExceptionCachedCounterLockManager (compression) <span title="The test is NOT RUN on upstream but has a SINGLE FAILURE on feature:
• Feature branch: a SINGLE FAILURE in 1 builds (1 to 1)
• Upstream branch: NOT RUN at all in 0 builds (na to na)">NEW 🔴 0 / 0
o.a.c.index.sai.cql.VectorSiftSmallTest.testSiftSmall (compression) <span title="The test is NOT RUN on upstream but has a SINGLE FAILURE on feature:
• Feature branch: a SINGLE FAILURE in 1 builds (1 to 1)
• Upstream branch: NOT RUN at all in 0 builds (na to na)">NEW 🔴 0 / 0
o.a.c.index.sai.cql.datamodels.QueryCellDeletionsWithCompoundKeyWithStaticsTest.testCellDeletions[aa] (compression) <span title="The test is NOT RUN on upstream but has a SINGLE FAILURE on feature:
• Feature branch: a SINGLE FAILURE in 1 builds (1 to 1)
• Upstream branch: NOT RUN at all in 0 builds (na to na)">NEW 🔴 0 / 0
o.a.c.index.sai.cql.datamodels.TinySegmentQueryCellDeletionsWithCompoundKeyWithStaticsTest.testCellDeletions[aa] (compression) <span title="The test is NOT RUN on upstream but has a SINGLE FAILURE on feature:
• Feature branch: a SINGLE FAILURE in 1 builds (1 to 1)
• Upstream branch: NOT RUN at all in 0 builds (na to na)">NEW 🔴 0 / 0
o.a.c.metrics.TrieMemtableMetricsTest.testContentionMetrics (compression) <span title="The test is NOT RUN on upstream but has a SINGLE FAILURE on feature:
• Feature branch: a SINGLE FAILURE in 1 builds (1 to 1)
• Upstream branch: NOT RUN at all in 0 builds (na to na)">NEW 🔴 0 / 0

No known test failures found

@pkolaczk pkolaczk marked this pull request as draft September 30, 2025 13:28
@pkolaczk
Copy link
Author

Putting this on hold, as apparently there are some parts of the code that rely on ordering of PrimaryKeys by their rowId and this breaks some queries involving static rows.

// This optimisation is valid only when both primary keys have clustering components.
// We must not compare by rowId when the clustering is empty, because two keys
// from the same partition may have different rowIds, yet they should be considered equal in that case.
if (o instanceof PrimaryKeyWithSource && !hasEmptyClustering())
Copy link
Member

Choose a reason for hiding this comment

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

We need a more nuanced implementation. The point of PrimaryKeyWithSource is to avoid calling loadDeferred(), but this does just that. I think we should consider moving PrimaryKeyWithSource logic into individual PrimaryKeyMap implementations, and then we can do checks on the schema when we load the map, not on each key. For example, we would take the slow path if there is a static column and the fast path otherwise. This also makes it easier to differentiate between partition aware and row aware keys.

Base automatically changed from cndb-15485 to cndb-main-release-202505 September 30, 2025 20:10
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