-
Notifications
You must be signed in to change notification settings - Fork 21
CNDB-16243: Improve ChunkCache Key in order to keep O(1) access time #2156
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
base: main
Are you sure you want to change the base?
Conversation
Checklist before you submit for review
|
pkolaczk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good. But this is something that can be easily (and cheaply) tested.
Especially it would be nice to reproduce the original issue in the test (like - which keys caused so many hashCollisions), and then demonstrate the the new hash is indeed better.
I am using this patch in the 1B vectors POC and the ConcurrentHashMap now works much better. I added unit tests (mostly generated by AI, with some modifications) to validate the implementation. |
pkolaczk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now
|
Improve hashCode of the Key to prevent collisions Implement Comparable<Key> in case the ConcurrentHashMap falls back in to Tree mode
9bb8f4f to
07fc356
Compare
❌ Build ds-cassandra-pr-gate/PR-2156 rejected by Butler1 regressions found Found 1 new test failures
Found 1 known test failures |



What is the issue
ConcurrentHashMap backing ChunkCache sometimes falls into Treeification ( O(log n) access time instead of O(1))
Full context in https://github.com/riptano/cndb/issues/16243
What does this PR fix and why was it fixed