Skip to content

CNDB-14481: Fix IllegalStateException in SegmentMetadataBuilder (#1808) #1887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025

Conversation

driftx
Copy link

@driftx driftx commented Jul 17, 2025

If an index analyzer produced no terms for a row, the index build could not complete and broke sstable flushing.

This commit makes the SegmentBuilder ignore the whole row if there are no terms. Additionally more assertions / preconditions have been added to improve diagnostics.

Fixes:
Failed to complete an index build
java.lang.IllegalStateException: Term range not set at
org.apache.cassandra.index.sai.disk.v1.SegmentMetadataBuilder.build(SegmentMetadataBuilder.java:145) at
org.apache.cassandra.index.sai.disk.v1.SegmentBuilder.flush(SegmentBuilder.java:470) at
org.apache.cassandra.index.sai.disk.v1.SSTableIndexWriter.flushSegment(SSTableIndexWriter.java:286) at
org.apache.cassandra.index.sai.disk.v1.SSTableIndexWriter.complete(SSTableIndexWriter.java:151)

@driftx
Copy link
Author

driftx commented Jul 17, 2025

Adjusted imports

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

@driftx driftx requested a review from djatnieks July 17, 2025 20:08
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
76.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@djatnieks
Copy link

Looks like there may be 4 new failures - can you take a quick look at those to see if they repro and if they can either be fixed easily or open a tracking ticket?
http://butler-stargazer.aws.dsinternal.org/#/ci/upstream/compare/ds-cassandra-pr-gate/CNDB-14841/to/ds-cassandra-build-nightly-5.0/main-5.0

If an index analyzer produced no terms for a row, the index
build could not complete and broke sstable flushing.

This commit makes the SegmentBuilder ignore the whole row
if there are no terms. Additionally more assertions / preconditions
have been added to improve diagnostics.

Fixes:
Failed to complete an index build
java.lang.IllegalStateException: Term range not set
at
org.apache.cassandra.index.sai.disk.v1.SegmentMetadataBuilder.build(SegmentMetadataBuilder.java:145)
at
org.apache.cassandra.index.sai.disk.v1.SegmentBuilder.flush(SegmentBuilder.java:470)
at
org.apache.cassandra.index.sai.disk.v1.SSTableIndexWriter.flushSegment(SSTableIndexWriter.java:286)
at
org.apache.cassandra.index.sai.disk.v1.SSTableIndexWriter.complete(SSTableIndexWriter.java:151)
@driftx
Copy link
Author

driftx commented Jul 18, 2025

Fixed by changing the exception to throw CorruptIndexException, and removed the check that validateChecksum is false in the snapshot tests since that is no longer true and prevented byteman from firing.

@cassci-bot
Copy link

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


32 new test failure(s) in 2 builds
See build details here


Found 32 new test failures

Showing only first 15 new test failures

Test Explanation Branch history Upstream history
...lidation.operations.AlterTest-compression_jdk11 regression 🔴🔴
...nQueryShouldNotTimeoutWhenItExceedesReadTimeout regression 🔴🔴
...nglePageReadIsFastButAggregationExceedesTimeout regression 🔴🔴
...adCommitLogAndSSTablesWithDroppedColumnTestCC40 regression 🔴🔴
...adCommitLogAndSSTablesWithDroppedColumnTestCC50 regression 🔴🔴
...oadCommitLogAndSSTablesWithDroppedColumnTestDSE regression 🔴🔴
...thRestartTest.testReadingValuesOfDroppedColumns regression 🔴🔴
o.a.c.d.t.s.f.FeaturesVersionSupportDBTest.testANN regression 🔴🔴
o.a.c.d.t.s.f.FeaturesVersionSupportDCTest.testANN regression 🔴🔴
o.a.c.d.t.s.f.FeaturesVersionSupportEBTest.testANN regression 🔴🔴
...c.FeaturesVersionSupportTest.testANNSupport[eb] regression 🔴🔴
....FeaturesVersionSupportTest.testGeoDistance[aa] regression 🔴🔴
....FeaturesVersionSupportTest.testGeoDistance[ba] regression 🔴🔴
...cySSTableTest.testVerifyOldDroppedTupleSSTables regression 🔴🔴
o.a.c.t.SSTablePartitionsTest.testDirectory regression 🔴🔴

Found 5 known test failures

@driftx driftx merged commit 76bc30d into main-5.0 Jul 18, 2025
568 of 589 checks passed
@driftx driftx deleted the CNDB-14841 branch July 18, 2025 16:17
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.

4 participants