CNDB-15608 port CASSANDRA-18673 to reduce disk usage of row-aware indexes in 5.0 - #2568
Open
k-rus wants to merge 3 commits into
Open
CNDB-15608 port CASSANDRA-18673 to reduce disk usage of row-aware indexes in 5.0#2568k-rus wants to merge 3 commits into
k-rus wants to merge 3 commits into
Conversation
…exes (#2122) Row aware SAI format increases significantly the size of SAI on disk. This increases the disk cost and creates incidents due to not enough disk space when SAI format version is changed from AA to newer version. This ports patches CASSANDRA-18673 to reduce disk size, and CASSANDRA-19011 to fix bug and improve the code in the initial patch. The disk size is reduced as compression is improved due to not prefixing with tokens, and due to removed a trie structure for storing sorted terms. The patch implements new disk format for SAI (GA, v9), which changes how row aware primary key map is stored in components. The primary key map is split into storing partition key map and clustering key map in separate components. Both, partition key map and clustering key map, use Key Store coming from Apache, which replaces the sorted terms structure of row aware primary key maps. As result the structure doesn't require ordering primary keys on partition keys and it's up to the caller to preserve the order and is preserved during flush by ordering on tokens. Partition keys are stored without token prefix to allow better compression. Clustering keys are sorted lexicographically within a partition. KeyLookup does not use tries terms dictionary, which used in SortedTerms. This requires to implement ceiling and floor methods in LondArray implementations. My understanding is that ceiling and floor methods are used for sorting and ANN. This doesn't exist in Apache. Because of specific case for clustering it was necessary to propagate and store a clustering flag and clustering comparator into index components and index descriptor. Tests are added to cover ported structures for new primary key map and its components. Other things got in with the ports of the patches: - Replace `hasEmptyClustering` methods with `hasClustering`, so it's consistently used only `hasClustering`. - Add error message on error during primary key map creation due to cursor failure. An attempt to reduce code duplications is included. It's mainly for primary key map and its tests, which required some refactoring. --------- Co-authored-by: Mike Adamson <madamson@datastax.com>
Checklist before you submit for review
|
Member
Author
Known failures and unrelated to the PR. |
Member
Author
|
CNDB's PR: https://github.com/riptano/cndb/pull/16672 |
`KeyLookupTest` tests `KeyLookup` introduced in v9 SAI disk format, which is used from `GA` version. However, the component file validation uses the default version, which is the earliest, i.e., `AA`. Specifies SAI format `GA`in validating components in `KeyLookupTest` instead of relying on default, which is the earliest SAI format, i.e., `AA`.
|
❌ Build ds-cassandra-pr-gate/PR-2568 rejected by Butler4 regressions found Found 4 new test failures
Found 4 known test failures |
Member
Author
|
Nightly build doesn't find new test failures. Reported failures are unrelated to the PR. |
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.




Cherry-pick of #2122 to
main-5.0. Fixes https://github.com/riptano/cndb/issues/15608, https://github.com/riptano/cndb/issues/17164, https://github.com/riptano/cndb/issues/17948CNDB PR: https://github.com/riptano/cndb/pull/16672
Row aware SAI format increases significantly the size of SAI on disk. This increases the disk cost and creates incidents due to not enough disk space when SAI format version is changed from AA to newer version.
This ports patches CASSANDRA-18673 to reduce disk size, and CASSANDRA-19011 to fix bug and improve the code in the initial patch.
The disk size is reduced as compression is improved due to not prefixing with tokens, and due to removed a trie structure for storing sorted terms.
The patch implements new disk format for SAI (GA, v9), which changes how row aware primary key map is stored in components. The primary key map is split into storing partition key map and clustering key map in separate components. Both, partition key map and clustering key map, use Key Store coming from Apache, which replaces the sorted terms structure of row aware primary key maps. As result the structure doesn't require ordering primary keys on partition keys and it's up to the caller to preserve the order and is preserved during flush by ordering on tokens. Partition keys are stored without token prefix to allow better compression. Clustering keys are sorted lexicographically within a partition.
KeyLookup does not use tries terms dictionary, which used in SortedTerms. This requires to implement ceiling and floor methods in LondArray implementations. My understanding is that ceiling and floor methods are used for sorting and ANN. This doesn't exist in Apache.
Because of specific case for clustering it was necessary to propagate and store a clustering flag and clustering comparator into index components and index descriptor.
Tests are added to cover ported structures for new primary key map and its components.
Other things got in with the ports of the patches:
hasEmptyClusteringmethods withhasClustering, so it's consistently used onlyhasClustering.An attempt to reduce code duplications is included. It's mainly for primary key map and its tests, which required some refactoring.