CNDB-16787: Make updates to VectorMemtableIndex min/max primary key atomic#2236
Open
michaeljmarshall wants to merge 1 commit intomainfrom
Open
CNDB-16787: Make updates to VectorMemtableIndex min/max primary key atomic#2236michaeljmarshall wants to merge 1 commit intomainfrom
michaeljmarshall wants to merge 1 commit intomainfrom
Conversation
Checklist before you submit for review
|
|
❌ Build ds-cassandra-pr-gate/PR-2236 rejected by Butler2 regressions found Found 2 new test failures
No known test failures found |
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/16787
CNDB test pr: https://github.com/riptano/cndb/pull/16790
What does this PR fix and why was it fixed
The
VectorMemtableIndexshould useAtomicReferencewrappers to ensure we atomically update the min and max primary keys. I used CAS loops to achieve a lockless solution.It appears possible to optimize this further by using
primaryKeys.first(), a constant time operation, to replace theminimumKeytracking. However, it's not clear that this is a hot spot, so I'll defer on changing the semantics for now. Another option could be to usegetPlain()since the max is monotonically increasing and the vast majority of updates will not bump the max key.