Repository navigation
[UIO, gridstore] generic Bitmask storage - #8501
Conversation
6393eac to
c6b05ab
Compare
c6b05ab to
3a88bde
Compare
| if self.mmap_slice.len() == 1 { | ||
| return if self.get(0).unwrap().max as usize >= num_blocks as usize { | ||
| pub fn find_fitting_gap(&self, num_blocks: u32) -> Result<Option<Range<RegionId>>> { | ||
| let slice = self.as_slice()?; |
There was a problem hiding this comment.
Note:
This reads the entire thing every time, which is potentially expensive if it is not cached in memory. Otherwise, this structure is expected to be quite small, so it should always fit in memory
There was a problem hiding this comment.
What is the alternative, some kind of iterative/batching approach?
If my calculations are correct:
- 1 GB stored = 6KB read here
- 1 TB stored = 6MB read here
There was a problem hiding this comment.
(reply to #8501 (comment))
So, ~16 KiB for a segment of 11M points. (assuming each point has a payload of 512 bytes)
I think a viable alternative is to keep the whole BitmaskGaps in the RAM.
There was a problem hiding this comment.
That's probably better, I'll add it to the backlog
3a88bde to
de35f48
Compare
d8deece to
cf3d190
Compare
cf3d190 to
3b15ed0
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/segment/benches/buffered_update_bitslice.rs (1)
5-11:⚠️ Potential issue | 🔴 CriticalDuplicate import of
MmapBitSlicewill cause compilation error.Line 5 adds the new import from the relocated
common::stored_bitslicemodule, but line 11 still imports from the oldsegment::common::stored_bitslicepath. Since the module was removed fromsegment::common, this will fail to compile.🐛 Proposed fix: remove stale import
use common::mmap::create_and_ensure_length; use common::stored_bitslice::MmapBitSlice; use common::universal_io::OpenOptions; use criterion::{Criterion, criterion_group, criterion_main}; use rand::prelude::*; use rand::rngs::StdRng; use segment::common::buffered_update_bitslice::BufferedUpdateBitSlice; -use segment::common::stored_bitslice::MmapBitSlice; use tempfile::tempdir;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/segment/benches/buffered_update_bitslice.rs` around lines 5 - 11, The file contains a duplicate/stale import of MmapBitSlice: remove the incorrect import path (segment::common::stored_bitslice::MmapBitSlice) and keep the correct one (common::stored_bitslice::MmapBitSlice) so the module resolves; specifically edit the use statements to delete the import line that references segment::common::stored_bitslice::MmapBitSlice and ensure BufferedUpdateBitSlice and OpenOptions imports remain unchanged.
🧹 Nitpick comments (2)
lib/gridstore/src/bitmask/mod.rs (1)
133-140: ReuseOPEN_OPTIONSinopen().
create()andcover_new_page()reopen the bitmask with explicit mutable flags, butopen()switches toOpenOptions::default(). Keeping those paths aligned makes the new generic backend less surprising after restart.♻️ Suggested change
- let bitslice = StoredBitSlice::open(&path, OpenOptions::default())?; + let bitslice = StoredBitSlice::open(&path, OPEN_OPTIONS)?;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/gridstore/src/bitmask/mod.rs` around lines 133 - 140, The open() function currently uses OpenOptions::default() to reopen the bitslice, which diverges from create() and cover_new_page() that use the shared OPEN_OPTIONS with explicit mutable flags; change StoredBitSlice::open(&path, OpenOptions::default()) to reuse the existing OPEN_OPTIONS constant so open(), create(), and cover_new_page() all open the bitmask with the same options (update the call site in open() to pass OPEN_OPTIONS.clone() or the appropriate reference to the shared OpenOptions value used elsewhere, ensuring types and mutability match StoredBitSlice::open).lib/common/common/src/stored_bitslice.rs (1)
107-139: Add direct coverage forread_bit_range().This method now underpins bitmask gap recomputation, but this file still only exercises whole-slice and single-bit reads. A couple of empty-range and cross-
u64cases would cover the trimming logic introduced here.If helpful, I can sketch a small test matrix for this method.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/common/common/src/stored_bitslice.rs` around lines 107 - 139, Add direct unit tests for StoredBitslice::read_bit_range to cover the new trimming/widening logic: write tests that call read_bit_range with an empty Range (expect empty BitSlice), a range contained within a single u64-aligned element (single-bit and small ranges), and a range that crosses a u64 boundary to exercise the elem_start/elem_end widening and bit_offset/bit_end trimming. Ensure you exercise both storage read variants by configuring the underlying storage to return Cow::Borrowed and Cow::Owned so the BitSlice and BitVec branches are covered; use assertions on the returned slice contents and lengths to validate correct trimming and offsets.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/gridstore/src/bitmask/gaps.rs`:
- Around line 149-176: The extend() method replaces the backend slice_store
without flushing prior set() updates, so flush any buffered/writer-local data on
the current self.slice_store via the UniversalWrite API (e.g., call the
appropriate flush/sync method such as flush() or sync_all() on self.slice_store
and handle its Result) before you call create_and_ensure_length() / before
reopening with S::open; ensure the flush error bubbles up rather than being
ignored so no pending gap writes are lost when slice_store is replaced.
---
Outside diff comments:
In `@lib/segment/benches/buffered_update_bitslice.rs`:
- Around line 5-11: The file contains a duplicate/stale import of MmapBitSlice:
remove the incorrect import path
(segment::common::stored_bitslice::MmapBitSlice) and keep the correct one
(common::stored_bitslice::MmapBitSlice) so the module resolves; specifically
edit the use statements to delete the import line that references
segment::common::stored_bitslice::MmapBitSlice and ensure BufferedUpdateBitSlice
and OpenOptions imports remain unchanged.
---
Nitpick comments:
In `@lib/common/common/src/stored_bitslice.rs`:
- Around line 107-139: Add direct unit tests for StoredBitslice::read_bit_range
to cover the new trimming/widening logic: write tests that call read_bit_range
with an empty Range (expect empty BitSlice), a range contained within a single
u64-aligned element (single-bit and small ranges), and a range that crosses a
u64 boundary to exercise the elem_start/elem_end widening and bit_offset/bit_end
trimming. Ensure you exercise both storage read variants by configuring the
underlying storage to return Cow::Borrowed and Cow::Owned so the BitSlice and
BitVec branches are covered; use assertions on the returned slice contents and
lengths to validate correct trimming and offsets.
In `@lib/gridstore/src/bitmask/mod.rs`:
- Around line 133-140: The open() function currently uses OpenOptions::default()
to reopen the bitslice, which diverges from create() and cover_new_page() that
use the shared OPEN_OPTIONS with explicit mutable flags; change
StoredBitSlice::open(&path, OpenOptions::default()) to reuse the existing
OPEN_OPTIONS constant so open(), create(), and cover_new_page() all open the
bitmask with the same options (update the call site in open() to pass
OPEN_OPTIONS.clone() or the appropriate reference to the shared OpenOptions
value used elsewhere, ensuring types and mutability match StoredBitSlice::open).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 217ead30-44bc-40f5-b9c7-de01dd4bb257
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
lib/common/common/src/lib.rslib/common/common/src/stored_bitslice.rslib/gridstore/Cargo.tomllib/gridstore/benches/bitmask_bench.rslib/gridstore/benches/real_data_bench.rslib/gridstore/src/bitmask/gaps.rslib/gridstore/src/bitmask/mod.rslib/gridstore/src/gridstore/mod.rslib/gridstore/src/gridstore/tests.rslib/segment/benches/buffered_update_bitslice.rslib/segment/src/common/buffered_update_bitslice.rslib/segment/src/common/mod.rslib/segment/src/id_tracker/immutable_id_tracker.rslib/segment/src/index/field_index/full_text_index/inverted_index/mmap_inverted_index/mod.rslib/segment/src/index/field_index/geo_index/mmap_geo_index.rslib/segment/src/index/field_index/map_index/mmap_map_index.rslib/segment/src/index/field_index/numeric_index/mmap_numeric_index.rslib/segment/src/payload_storage/mmap_payload_storage.rs
💤 Files with no reviewable changes (1)
- lib/segment/src/common/mod.rs
✅ Files skipped from review due to trivial changes (11)
- lib/segment/src/common/buffered_update_bitslice.rs
- lib/segment/src/id_tracker/immutable_id_tracker.rs
- lib/common/common/src/lib.rs
- lib/gridstore/Cargo.toml
- lib/segment/src/index/field_index/map_index/mmap_map_index.rs
- lib/segment/src/index/field_index/full_text_index/inverted_index/mmap_inverted_index/mod.rs
- lib/gridstore/benches/real_data_bench.rs
- lib/segment/src/index/field_index/geo_index/mmap_geo_index.rs
- lib/gridstore/src/gridstore/tests.rs
- lib/gridstore/benches/bitmask_bench.rs
- lib/segment/src/index/field_index/numeric_index/mmap_numeric_index.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- lib/segment/src/payload_storage/mmap_payload_storage.rs
| /// Extends the file to fit the new regions | ||
| pub fn extend(&mut self, iter: impl ExactSizeIterator<Item = RegionGaps>) -> Result<()> { | ||
| let data: Vec<RegionGaps> = iter.collect(); | ||
| if data.is_empty() { | ||
| return Ok(()); | ||
| } | ||
|
|
||
| // reopen the file with a larger size | ||
| let prev_len = self.mmap_slice.len(); | ||
| let new_slice_len = prev_len + iter.len(); | ||
| let prev_len = self.len()?; | ||
| let new_slice_len = prev_len + data.len(); | ||
| let new_length_in_bytes = new_slice_len * size_of::<RegionGaps>(); | ||
|
|
||
| create_and_ensure_length(&self.path, new_length_in_bytes).unwrap(); | ||
| create_and_ensure_length(&self.path, new_length_in_bytes)?; | ||
|
|
||
| let mmap = open_write_mmap(&self.path, AdviceSetting::from(Advice::Normal), false)?; | ||
|
|
||
| self.mmap_slice = unsafe { MmapSlice::try_from(mmap) }?; | ||
| let options = OpenOptions { | ||
| writeable: true, | ||
| need_sequential: false, | ||
| disk_parallel: None, | ||
| populate: Some(false), | ||
| advice: Some(AdviceSetting::Advice(Advice::Normal)), | ||
| prevent_caching: None, | ||
| }; | ||
| self.slice_store = S::open(&self.path, options)?; | ||
|
|
||
| debug_assert_eq!(self.mmap_slice[prev_len..].len(), iter.len()); | ||
| debug_assert_eq!(self.len()? - prev_len, data.len()); | ||
|
|
||
| self.mmap_slice[prev_len..].fill_with(|| iter.next().unwrap()); | ||
| let byte_offset = (prev_len * size_of::<RegionGaps>()) as u64; | ||
| self.slice_store.write(byte_offset, &data)?; |
There was a problem hiding this comment.
Flush pending gap writes before reopening slice_store.
extend() replaces the current backend handle after resizing the file, but it never flushes earlier set() updates. With the new generic UniversalWrite abstraction, reopening can lose or hide handle-local buffered writes, so growing the bitmask can resurrect stale gap metadata and send later allocations down the wrong search path.
🩹 Suggested fix
pub fn extend(&mut self, iter: impl ExactSizeIterator<Item = RegionGaps>) -> Result<()> {
let data: Vec<RegionGaps> = iter.collect();
if data.is_empty() {
return Ok(());
}
+ let flusher = self.slice_store.flusher();
+ flusher()?;
+
// reopen the file with a larger size
let prev_len = self.len()?;
let new_slice_len = prev_len + data.len();
let new_length_in_bytes = new_slice_len * size_of::<RegionGaps>();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@lib/gridstore/src/bitmask/gaps.rs` around lines 149 - 176, The extend()
method replaces the backend slice_store without flushing prior set() updates, so
flush any buffered/writer-local data on the current self.slice_store via the
UniversalWrite API (e.g., call the appropriate flush/sync method such as flush()
or sync_all() on self.slice_store and handle its Result) before you call
create_and_ensure_length() / before reopening with S::open; ensure the flush
error bubbles up rather than being ignored so no pending gap writes are lost
when slice_store is replaced.
| if self.mmap_slice.len() == 1 { | ||
| return if self.get(0).unwrap().max as usize >= num_blocks as usize { | ||
| pub fn find_fitting_gap(&self, num_blocks: u32) -> Result<Option<Range<RegionId>>> { | ||
| let slice = self.as_slice()?; |
There was a problem hiding this comment.
What is the alternative, some kind of iterative/batching approach?
If my calculations are correct:
- 1 GB stored = 6KB read here
- 1 TB stored = 6MB read here
3b15ed0 to
96c8485
Compare
| if self.mmap_slice.len() == 1 { | ||
| return if self.get(0).unwrap().max as usize >= num_blocks as usize { | ||
| pub fn find_fitting_gap(&self, num_blocks: u32) -> Result<Option<Range<RegionId>>> { | ||
| let slice = self.as_slice()?; |
There was a problem hiding this comment.
(reply to #8501 (comment))
So, ~16 KiB for a segment of 11M points. (assuming each point has a payload of 512 bytes)
I think a viable alternative is to keep the whole BitmaskGaps in the RAM.
| let gaps = Self::calculate_gaps(bitslice, self.config.region_size_blocks); | ||
|
|
||
| *self.regions_gaps.get_mut(region_id) = gaps; | ||
| self.regions_gaps.set(region_id, gaps)?; |
There was a problem hiding this comment.
Performance: we can use UniversalWrite::write_batch here instead of calling UniversalWrite::write in a loop.
Or (maybe it's complicated/outside of scope of this PR), this can be merged with set_ascending_bits_batch so a single call write_multi can be used in mark_blocks_batch to write both bitmask.dat and gaps.dat.
📝 WalkthroughWalkthroughThis pull request generalizes the storage layer in Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/gridstore/src/bitmask/mod.rs (1)
413-428:⚠️ Potential issue | 🟠 MajorHandle partial failures between bit writes and gap updates.
mark_blocks_batchmutates the bitmask first, then persists recomputed region gaps. Ifupdate_region_gaps()fails after any bit write succeeds, the persisted bitmask and gap summary diverge, and future allocation can miss free space or stop on stale candidate regions.Please add an explicit consistency strategy here: e.g. precompute affected region states before writing, batch/transactionalize both stores where possible, or document and recover from dirty metadata on reopen.
Also applies to: 431-443
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/gridstore/src/bitmask/mod.rs` around lines 413 - 428, The code currently mutates bits via set_ascending_bits_batch inside mark_blocks_batch then calls update_region_gaps, which can leave bitmask and gap summaries inconsistent on partial failure; instead precompute the affected dirty_regions and the new region-gap state (based on current state + intended used flag) before writing, then perform a transactional update: either call update_region_gaps first and only apply set_ascending_bits_batch if gap-persistence succeeds, or (if the backend supports transactions) bundle both writes together, or else implement a compensating rollback that uses the list of successfully-written indices from set_ascending_bits_batch to revert the bit changes on update_region_gaps failure; reference set_ascending_bits_batch, update_region_gaps and mark_blocks_batch when making the change.
🧹 Nitpick comments (1)
lib/gridstore/src/bitmask/mod.rs (1)
133-133: Consider usingOPEN_OPTIONSfor consistency with other methods opening the bitmask file.The
open()method usesOpenOptions::default()whilecreate()andcover_new_page()use theOPEN_OPTIONSconstant. Although both are writeable, using the same options throughout would be more consistent and better reflects that bitmask access is random, not sequential.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/gridstore/src/bitmask/mod.rs` at line 133, The call to StoredBitSlice::open currently uses OpenOptions::default() which is inconsistent with other methods (create, cover_new_page) that use the OPEN_OPTIONS constant; update the open call in the open() method to use OPEN_OPTIONS instead of OpenOptions::default() so all bitmask file opens use the same options and reflect random-access writeable semantics (reference StoredBitSlice::open, OPEN_OPTIONS, create(), cover_new_page, and the open() method where path is passed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/gridstore/src/bitmask/mod.rs`:
- Around line 35-36: BitmaskStorage is declared public but bounds reference the
private type RegionGaps (from the gaps module), making the trait impossible for
external crates to name/implement; fix by either (A) making BitmaskStorage
crate-private (change to pub(crate) BitmaskStorage and its impl) or (B)
decoupling the public trait from RegionGaps by replacing the bound
UniversalWrite<RegionGaps> with a public abstraction (e.g., a public wrapper
type or a new public trait name like RegionGapWrite) or by making RegionGaps
itself public; update the BitmaskStorage declaration and its impl accordingly
(referencing BitmaskStorage, UniversalWrite, RegionGaps, and the gaps module) so
the public API no longer exposes private types.
---
Outside diff comments:
In `@lib/gridstore/src/bitmask/mod.rs`:
- Around line 413-428: The code currently mutates bits via
set_ascending_bits_batch inside mark_blocks_batch then calls update_region_gaps,
which can leave bitmask and gap summaries inconsistent on partial failure;
instead precompute the affected dirty_regions and the new region-gap state
(based on current state + intended used flag) before writing, then perform a
transactional update: either call update_region_gaps first and only apply
set_ascending_bits_batch if gap-persistence succeeds, or (if the backend
supports transactions) bundle both writes together, or else implement a
compensating rollback that uses the list of successfully-written indices from
set_ascending_bits_batch to revert the bit changes on update_region_gaps
failure; reference set_ascending_bits_batch, update_region_gaps and
mark_blocks_batch when making the change.
---
Nitpick comments:
In `@lib/gridstore/src/bitmask/mod.rs`:
- Line 133: The call to StoredBitSlice::open currently uses
OpenOptions::default() which is inconsistent with other methods (create,
cover_new_page) that use the OPEN_OPTIONS constant; update the open call in the
open() method to use OPEN_OPTIONS instead of OpenOptions::default() so all
bitmask file opens use the same options and reflect random-access writeable
semantics (reference StoredBitSlice::open, OPEN_OPTIONS, create(),
cover_new_page, and the open() method where path is passed).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 994e6fe9-6250-49eb-b1ef-4c3a54de0bfa
📒 Files selected for processing (3)
lib/gridstore/src/bitmask/gaps.rslib/gridstore/src/bitmask/mod.rslib/segment/benches/buffered_update_bitslice.rs
✅ Files skipped from review due to trivial changes (1)
- lib/segment/benches/buffered_update_bitslice.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- lib/gridstore/src/bitmask/gaps.rs
| pub trait BitmaskStorage: UniversalWrite<RegionGaps> + UniversalWrite<u64> {} | ||
| impl<T> BitmaskStorage for T where T: UniversalWrite<RegionGaps> + UniversalWrite<u64> {} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify visibility of RegionGaps and whether private-bounds warnings are denied in this crate.
rg -n -C3 '^(pub(\([^)]*\))?\s+)?(struct|trait)\s+RegionGaps\b|^mod\s+gaps\b|pub\s+trait\s+BitmaskStorage\b'
rg -n -C3 '#!\[(deny|forbid)\((warnings|private_bounds|private_interfaces)'Repository: qdrant/qdrant
Length of output: 1289
🏁 Script executed:
# Check for private_bounds lint configuration in crate root files
find lib/gridstore -maxdepth 2 -name "lib.rs" -o -name "mod.rs" | head -5 | xargs -I {} grep -n "private_bounds\|private_interfaces" {}
# Check for any deny/forbid directives anywhere in the crate
find lib/gridstore -name "*.rs" | xargs grep -l "#!\[(deny|forbid)" | head -3
# Check the main lib.rs for this module
cat lib/gridstore/src/lib.rs | head -50Repository: qdrant/qdrant
Length of output: 525
🏁 Script executed:
# Check if BitmaskStorage trait is re-exported or used publicly
rg -n "BitmaskStorage" lib/gridstore/src --type rust -B2 -A2
# Check if gaps module or RegionGaps is re-exported
rg -n "pub use.*gaps\|pub use.*RegionGaps" lib/gridstore/src --type rustRepository: qdrant/qdrant
Length of output: 824
🏁 Script executed:
# Check for Cargo.toml to see Rust edition and lint settings
cat lib/gridstore/Cargo.toml
# Check for any #![...] lint directives in lib.rs
cat lib/gridstore/src/lib.rs | grep -A5 -B5 "#!"
# Check if RegionGaps is actually exported publicly from the bitmask module
rg -n "pub use.*RegionGaps\|pub.*RegionGaps" lib/gridstore/src/bitmask/ --type rustRepository: qdrant/qdrant
Length of output: 1432
🏁 Script executed:
# Check workspace Cargo.toml for lint configuration
find . -maxdepth 2 -name "Cargo.toml" -exec grep -l "\[lints\]" {} \;
# Check the workspace root Cargo.toml
cat Cargo.toml | head -100Repository: qdrant/qdrant
Length of output: 2806
🏁 Script executed:
# Find and display the [lints] section in the workspace Cargo.toml
cat Cargo.toml | sed -n '/^\[lints\]/,/^\[/p' | head -50Repository: qdrant/qdrant
Length of output: 93
🏁 Script executed:
# Check for lints definition in the workspace root or in a lints config file
rg -n "^\[lints\]" --type toml -A20 Cargo.toml
# Also check if there's a lints section after the package definition
sed -n '1,/^\[dependencies\]/p' Cargo.toml | grep -A50 "\[lints\]"
# Check if there's a lints.toml or similar config
find . -maxdepth 2 -name "*.toml" -exec grep -l "private_bounds\|private_interfaces" {} \;Repository: qdrant/qdrant
Length of output: 1624
🏁 Script executed:
# Search the entire root Cargo.toml for the actual lints definitions
cat Cargo.toml | tail -200 | head -150Repository: qdrant/qdrant
Length of output: 4319
🏁 Script executed:
# Search for where lints are actually defined in the workspace
grep -r "^\[lints\]" --include="*.toml" . 2>/dev/null | grep -v ".git" | head -10
# Check if there's a dedicated lints definition in the root Cargo.toml
tail -100 Cargo.tomlRepository: qdrant/qdrant
Length of output: 2502
🏁 Script executed:
# Search for the actual lints table definition in root Cargo.toml (not just [lints] header)
awk '/^\[lints\]/{flag=1; next} /^\[/{flag=0} flag' Cargo.tomlRepository: qdrant/qdrant
Length of output: 74
🏁 Script executed:
# Check if there's a cargo config directory
find . -maxdepth 3 -name ".cargo" -type d -exec find {} -name "*.toml" \;
# Check if any member crate has the actual lints definitions
for toml in lib/api/Cargo.toml lib/collection/Cargo.toml lib/gridstore/Cargo.toml; do
echo "=== $toml ==="
awk '/^\[lints\]/{flag=1; next} /^\[/{flag=0} flag' "$toml" | head -20
doneRepository: qdrant/qdrant
Length of output: 204
🏁 Script executed:
# Search for the actual lints definitions - they might be after the workspace definition
awk '/^\[workspace\]/{flag=1} /^\[workspace.*lints\]/{lints=1} lints' Cargo.toml | head -50Repository: qdrant/qdrant
Length of output: 39
🏁 Script executed:
# Check the end of Cargo.toml for a workspace.lints section
tail -200 Cargo.toml | grep -A50 "\[workspace"Repository: qdrant/qdrant
Length of output: 1118
🏁 Script executed:
# Check if there's a workspace.lints section by looking at the entire file
wc -l Cargo.toml
# Look for any lints configuration in the entire file
grep -n "lints\|lint" Cargo.toml | head -20Repository: qdrant/qdrant
Length of output: 168
🏁 Script executed:
# Display the workspace.lints configuration
sed -n '167,220p' Cargo.tomlRepository: qdrant/qdrant
Length of output: 1707
🏁 Script executed:
# Check if BitmaskStorage is re-exported publicly or if Bitmask is the public API
rg -n "pub.*BitmaskStorage\|pub use.*BitmaskStorage" lib/gridstore/src --type rust
# Check the actual public methods and types in the bitmask module
sed -n '35,100p' lib/gridstore/src/bitmask/mod.rsRepository: qdrant/qdrant
Length of output: 2362
🏁 Script executed:
# Check what's exported from the bitmask module in lib.rs
cat lib/gridstore/src/lib.rs
# Verify if RegionGaps is accessible from outside
rg -n "pub use.*gaps\|pub use.*RegionGaps\|pub.*gaps" lib/gridstore/src/bitmask/ --type rustRepository: qdrant/qdrant
Length of output: 525
Avoid exposing private RegionGaps in the public storage trait.
BitmaskStorage is public, but its supertrait bounds mention RegionGaps from the private gaps module. External code cannot name or directly implement this bound because the type is from a private module, making the public trait unusable outside the crate.
Consider either keeping the generic storage API crate-private, or exposing a public storage abstraction that does not depend on RegionGaps.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@lib/gridstore/src/bitmask/mod.rs` around lines 35 - 36, BitmaskStorage is
declared public but bounds reference the private type RegionGaps (from the gaps
module), making the trait impossible for external crates to name/implement; fix
by either (A) making BitmaskStorage crate-private (change to pub(crate)
BitmaskStorage and its impl) or (B) decoupling the public trait from RegionGaps
by replacing the bound UniversalWrite<RegionGaps> with a public abstraction
(e.g., a public wrapper type or a new public trait name like RegionGapWrite) or
by making RegionGaps itself public; update the BitmaskStorage declaration and
its impl accordingly (referencing BitmaskStorage, UniversalWrite, RegionGaps,
and the gaps module) so the public API no longer exposes private types.
Refactors gridstore's
Bitmaskto use a generic backend for interacting with storage. Particularly, it does it forBitmaskGapsslice, and for the main bitslice itself.In doing so, I also moved the
stored_bitslice.rsfromsegmentintocommon