CNDB-8756: Keep all the SAI components of a sstable in the same version#2243
Open
CNDB-8756: Keep all the SAI components of a sstable in the same version#2243
Conversation
Checklist before you submit for review
|
c475f79 to
841244f
Compare
841244f to
a97e4b1
Compare
|
New per-index components for a sstable will use the version of any existing per-sstable components in that same sstable. If there aren't any previous per-sstable components then the configured current version will be used. A sstable can have per-sstable components if they have been added by another index. New sstables will always use the current version. This means that all the index components of a sstable will always use the same index version, even though different sstables can have different versions. Rebuilding indexes after changing the current version won't change the version of the existing sstable indexes, although new sstables will use the new current version. However, sstableupgrade will rewrite the tables with the new version. Thus, the procedure to upgrade indexes is first setting the current version and then running sstableupgrade. Creating a new index will fail if there is any sstable in the indexed table using a version that doesn't support the type of index we are creating. For example, creating a vector index will fail if there is still some sstable using the aa format, even in the current version supports indexes. If an index creation fails for this reason, the index will be added to the schema but marked as failed. Running sstableupgrade will upgrade the index version, but it won't mark the index as queryable, so it will be needed to also rebuild the index so it becomes queryable. # Conflicts: # src/java/org/apache/cassandra/index/sai/disk/format/IndexDescriptor.java
a97e4b1 to
1084030
Compare
|
❌ Build ds-cassandra-pr-gate/PR-2243 rejected by Butler3 regressions found Found 3 new test failures
Found 7 known test failures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What is the issue
Fixes https://github.com/riptano/cndb/issues/8756:
SAI indexes are mostly independent, so you can legitimately have index X with version A and index Y with version B for the same sstable.
However, all indexes share a single PrimaryKeyMap, so an index that assumes the PKM is row-based will not be compatible with one that uses a partition-based PMK.
Here is an example of the issues we can have if a sstable ends up with two indexes with incompatible formats:
Querying the second index fails because its per-index components use
Version.LATEST, which is row-aware, while its per-sstable components useVersion.EARLIEST, which is partition-aware.What does this PR fix and why was it fixed
New per-index components for a sstable will use the version of any existing per-sstable components in that same sstable. If there aren't any previous per-sstable components then the configured current version will be used. A sstable can have per-sstable components if they have been added by another index. New sstables will always use the current version.
This means that all the index components of a sstable will always use the same index version, even though different sstables can have different versions.
Rebuilding indexes after changing the current version won't change the version of the existing sstable indexes, although new sstables will use the new current version. However, sstableupgrade will rewrite the tables with the new version. Thus, the procedure to upgrade indexes is first setting the current version and then running sstableupgrade.
Creating a new index will fail if there is any sstable in the indexed table using a version that doesn't support the type of index we are creating. For example, creating a vector index will fail if there is still some sstable using the aa format, even in the current version supports indexes. If an index creation fails for this reason, the index will be added to the schema but marked as failed. Running sstableupgrade will upgrade the index version, but it won't mark the index as queryable, so it will be needed to also rebuild the index so it becomes queryable.