Skip to content

Conversation

@pcmanus
Copy link

@pcmanus pcmanus commented Oct 20, 2025

Updates the file formatting methods for SAI Version.AA to handle the generation used by immutable components, enabling the option to use immutable components with version AA.

This also add a new cassandra.sai.immutable_components.min_version system property that allows to defines the minimum verison starting from which the existing cassandra.sai.immutable_components option will apply. As of this patch, this defaults to ca, because it is the behavior before this patch, but it can change to aa to allow using immutable components with Version.AA.

Fixes https://github.com/riptano/cndb/issues/15745.

@github-actions
Copy link

github-actions bot commented Oct 20, 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

@eolivelli eolivelli requested a review from pkolaczk October 20, 2025 14:21
@pcmanus pcmanus force-pushed the CNDB-15745-immutable-components-in-AA branch from 69965fa to 70fb738 Compare October 21, 2025 09:15
Copy link

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

Looking for forward to @pkolaczk 's review

Copy link

@pkolaczk pkolaczk left a comment

Choose a reason for hiding this comment

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

Looks good to me.
I have two nitpicks about the code that was already there, but is nearby. Up to you if you want to improve it.

Comment on lines 471 to 473
// Allow restoring legacy behavior of deleting sai components before a rebuild (which implies a rebuild cannot be
// done without first stopping reads on that index)
IMMUTABLE_SAI_COMPONENTS("cassandra.sai.immutable_components", "false"),

Choose a reason for hiding this comment

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

Side note: This comment is not very clear explaining whether the property should be set to true or false to restore the legacy behavior. I believe if the property is false then the behavior is legacy because ISC are disabled, correct?

Copy link
Author

Choose a reason for hiding this comment

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

You're right, both that it's a bit confusing and that the default, false, is the legacy. I've amended the comment.

Comment on lines 314 to 318
int generation = 0;
String maybeGenerationStr = componentStr.substring(lastSepIdx + 1, componentStr.length() - 3);

Choose a reason for hiding this comment

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

This is going to throw IndexOutOfBoundsException if the string doesn't contain anything after the separator, because the endIndex would be smaller than beginIndex param to substring().

This is unlikely to happen, but because this method reports unparseable strings as empty Optional then I think we should handle that case for consistency.

Copy link
Author

Choose a reason for hiding this comment

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

This is going to throw IndexOutOfBoundsException if the string doesn't contain anything after the separator

It technically can't because this (private) method is only called from the tryParseFilename one which ensures the filename ended with .db.

With that said, the method was still a bit fragile around this as if the file ended by _.db, then the substring above didn't throw, but was returning an empty string, which was later parsed as an IndexComponentType, and this resulted in a "successful" parse but where the parsed IndexComponentType was null, which is unexpected and would have thrown. Anyway, I handled that case here and added tests for this.

Updates the file formatting methods for SAI `Version.AA` to handle the
generation used by immutable components, enabling the option to
use immutable components with version AA.

This also add a new `cassandra.sai.immutable_components.min_version`
system property that allows to defines the minimum verison starting from
which the existing `cassandra.sai.immutable_components` option will
apply. As of this patch, this defaults to `ca`, because it is
the behavior before this patch, but it can change to `aa` to
allow using immutable components with `Version.AA`.

Fixes #15745.
@pcmanus pcmanus force-pushed the CNDB-15745-immutable-components-in-AA branch from 70fb738 to 1484a69 Compare October 29, 2025 14:12
@sonarqubecloud
Copy link

@cassci-bot
Copy link

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


Approved by Butler
See build details here

@pcmanus pcmanus merged commit cd21102 into main Oct 29, 2025
490 of 494 checks passed
@pcmanus pcmanus deleted the CNDB-15745-immutable-components-in-AA branch October 29, 2025 16:25
michaelsembwever pushed a commit that referenced this pull request Nov 5, 2025
…ion (#2079)

Updates the file formatting methods for SAI `Version.AA` to handle the
generation used by immutable components, enabling the option to use
immutable components with version AA.

This also add a new `cassandra.sai.immutable_components.min_version`
system property that allows to defines the minimum verison starting from
which the existing `cassandra.sai.immutable_components` option will
apply. As of this patch, this defaults to `ca`, because it is the
behavior before this patch, but it can change to `aa` to allow using
immutable components with `Version.AA`.

Fixes riptano/cndb#15745.
michaelsembwever pushed a commit that referenced this pull request Nov 14, 2025
…ion (#2079)

Updates the file formatting methods for SAI `Version.AA` to handle the
generation used by immutable components, enabling the option to use
immutable components with version AA.

This also add a new `cassandra.sai.immutable_components.min_version`
system property that allows to defines the minimum verison starting from
which the existing `cassandra.sai.immutable_components` option will
apply. As of this patch, this defaults to `ca`, because it is the
behavior before this patch, but it can change to `aa` to allow using
immutable components with `Version.AA`.

Fixes riptano/cndb#15745.
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