feat: add multi_get() for batch point reads#274
Conversation
- Add `multi_get()` to `AbstractTree` trait with default implementation that calls `get()` in a loop - `Tree` and `BlobTree` provide optimized versions - BlobTree extracts a `resolve_key` helper for shared blob resolution logic - Accepts unsorted keys — callers don't need to pre-sort - New integration test covering basic retrieval, snapshot isolation, missing keys, and unsorted input Closes #96
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a batch-read API Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
Pull request overview
Adds a new batch point-read API (multi_get) to the AbstractTree interface, with optimized implementations for Tree and BlobTree, plus integration tests to validate snapshot semantics and mixed-key behavior.
Changes:
- Added
AbstractTree::multi_get()with a default implementation that delegates toget()per key. - Implemented optimized
multi_get()forTreeandBlobTreeusing a single snapshot (SuperVersion) per call. - Added an integration test suite covering existing/missing keys, tombstones, disk vs memtable, snapshot isolation, and unsorted/duplicate inputs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/multi_get.rs | New integration tests validating multi_get correctness across key mixes, snapshots, tombstones, disk/memtable, and kv-separation. |
| src/tree/mod.rs | Adds a Tree override of multi_get that reads from a single snapshot for all keys. |
| src/blob_tree/mod.rs | Extracts a shared resolve_key helper and adds a BlobTree override of multi_get using a single snapshot. |
| src/abstract_tree.rs | Introduces the multi_get API and documents snapshot/locking behavior and a usage example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Explicitly state that the returned Vec has the same length as the input, preserves input order, returns None for missing keys, and produces duplicate entries for duplicate input keys.
…s#276 Cherry-picked from upstream contribution branches: - bae6679: document multi_get() output contract (same length, same order, None for missing) - bd7cfaf: rewrite intra-L0 ordering test to exercise Version::with_merge directly (conflict resolved: took upstream's improved test that validates run position)
…jall-rs#276" This reverts commit 8a14512.
There was a problem hiding this comment.
Pull request overview
Adds a multi_get() batch point-read API to the AbstractTree trait, with optimized implementations for Tree and BlobTree, plus integration coverage to validate ordering/duplicates and MVCC snapshot semantics.
Changes:
- Added
AbstractTree::multi_get()with a default implementation and documented output contract (order/length/duplicates). - Implemented optimized
multi_get()forTree(single snapshot acquisition) andBlobTree(single snapshot + sharedresolve_keyhelper). - Added
tests/multi_get.rsintegration tests covering existing/missing keys, empty input, snapshot isolation, tombstones, disk+memtable, blob separation, and unsorted/duplicate keys.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/multi_get.rs | New integration tests validating multi_get() behavior across storage layers and MVCC semantics. |
| src/tree/mod.rs | Adds an optimized Tree::multi_get() using a single snapshot version. |
| src/blob_tree/mod.rs | Refactors blob resolution into resolve_key() and adds BlobTree::multi_get() using a single snapshot. |
| src/abstract_tree.rs | Adds the multi_get() API with default behavior and documented output contract + example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
multi_get()toAbstractTreetrait for batch point readsget()in a loop;TreeandBlobTreeprovide optimized versionsresolve_keyhelper for shared blob resolution logicTest plan
multi_getcovering basic retrieval, snapshot isolation, missing keys, unsorted inputcargo test --all-featuresgreenCloses #96
Supersedes #264 (clean rebased branch — sorry about the mess in that one).
Summary by CodeRabbit
New Features
Tests