-
Notifications
You must be signed in to change notification settings - Fork 1.8k
UUID index bug #6916
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
UUID index bug #6916
Conversation
📝 Walkthrough""" WalkthroughThe changes span three main areas. In Estimated code review effort2 (~20 minutes) Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Old files without this fix create a panic on startup, which initializes the shard as dummy
ERROR qdrant::startup: Panic occurred in file lib/common/common/src/mmap_hashmap.rs at line 473: Error reading u128 from mmap: The conversion failed because the address of the source is not a multiple of the alignment of the destination type.
Source type: &[u8]
Source address: 0x11cff0728 (a multiple of 8)
Destination type: u128
Destination alignment: 16
this is not a new behavior, but it is a behavior of the debug build. Previous version also paniked, now it will panic(in debug) earlier, and print error messages in production. |
Also, not related to this particular PR, but it's better not to bake I.e., in impl Key for u128 {
- const ALIGN: usize = align_of::<u128>();
+ const ALIGN: usize = size_of::<u128>(); |
* reproduce bug as unit test * reproduce in even faster unit test * fix alignment in mmap_hashmap * clippy * review fixes
MmapHashMap had a problem with Entry alightment, in case if key value was u128. It required 16bit alightment, but
storage assumed, apparently, that nothing can need more than 8 bit alignment.
This PR introduces 2 unit tests + fix.
Fix is another alignment block inside MmapHashmap. If Required alignment is <8, there are no change and format exactly same as before. If required alignment >8, we put extra empty bytes before bucket offsets, so that
(new_alignment + buckets) % ALIGNMENT = 0.
Compatibility: luckily (thanks to @xzfc) bucket offset is stored explicitly in the header of the file.
So the same code should be able to read both: files with and without offset, even if old files were created for u128 key.