Repository navigation
split read only vector store - #8852
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR splits the vector storage API by introducing Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/segment/src/vector_storage/multi_dense/volatile_multi_dense_vector_storage.rs (1)
241-248:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winReport the actual element datatype here.
VolatileMultiDenseVectorStorage<T>is generic, but this method always returnsFloat32. That breaks thenew_volatile_multi_dense_vector_storage_byteandnew_volatile_multi_dense_vector_storage_halfvariants defined in the same file, and any read-only caller that branches onVectorStorageRead::datatype()will now see the wrong storage type.Suggested fix
fn datatype(&self) -> VectorStorageDatatype { - VectorStorageDatatype::Float32 + T::datatype() }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/segment/src/vector_storage/multi_dense/volatile_multi_dense_vector_storage.rs` around lines 241 - 248, The datatype() impl on VolatileMultiDenseVectorStorage<T> incorrectly always returns Float32; change it to return the actual element datatype for T (used by new_volatile_multi_dense_vector_storage_byte/half). Update VectorStorageRead::datatype implementation in VolatileMultiDenseVectorStorage<T> to return the datatype provided by the element type (e.g., use an associated constant or method on the PrimitiveVectorElement trait such as T::DATATYPE / T::vector_datatype() or similar) so callers see the correct VectorStorageDatatype for the generic T.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@lib/segment/src/vector_storage/multi_dense/volatile_multi_dense_vector_storage.rs`:
- Around line 241-248: The datatype() impl on VolatileMultiDenseVectorStorage<T>
incorrectly always returns Float32; change it to return the actual element
datatype for T (used by new_volatile_multi_dense_vector_storage_byte/half).
Update VectorStorageRead::datatype implementation in
VolatileMultiDenseVectorStorage<T> to return the datatype provided by the
element type (e.g., use an associated constant or method on the
PrimitiveVectorElement trait such as T::DATATYPE / T::vector_datatype() or
similar) so callers see the correct VectorStorageDatatype for the generic T.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2c19b67c-d214-4f7a-a5d7-9583547dc132
📒 Files selected for processing (45)
lib/collection/src/collection_manager/optimizers/vacuum_optimizer.rslib/segment/benches/sparse_index_build.rslib/segment/benches/sparse_vector_storage.rslib/segment/src/fixtures/sparse_fixtures.rslib/segment/src/index/hnsw_index/graph_layers.rslib/segment/src/index/hnsw_index/graph_layers_builder.rslib/segment/src/index/hnsw_index/graph_layers_healer.rslib/segment/src/index/hnsw_index/hnsw.rslib/segment/src/index/hnsw_index/point_scorer.rslib/segment/src/index/plain_vector_index.rslib/segment/src/index/query_optimization/condition_converter.rslib/segment/src/index/sparse_index/sparse_vector_index.rslib/segment/src/index/struct_payload_index.rslib/segment/src/payload_storage/query_checker.rslib/segment/src/segment/entry.rslib/segment/src/segment/segment_ops.rslib/segment/src/segment/tests/test_vector_name_ops.rslib/segment/src/segment_constructor/batched_reader.rslib/segment/src/segment_constructor/segment_builder.rslib/segment/src/segment_constructor/segment_constructor_base.rslib/segment/src/vector_storage/dense/appendable_dense_vector_storage.rslib/segment/src/vector_storage/dense/dense_vector_storage.rslib/segment/src/vector_storage/dense/empty_dense_vector_storage.rslib/segment/src/vector_storage/dense/volatile_dense_vector_storage.rslib/segment/src/vector_storage/memory_reporter.rslib/segment/src/vector_storage/multi_dense/appendable_mmap_multi_dense_vector_storage.rslib/segment/src/vector_storage/multi_dense/volatile_multi_dense_vector_storage.rslib/segment/src/vector_storage/prefill_deleted.rslib/segment/src/vector_storage/quantized/quantized_vectors.rslib/segment/src/vector_storage/sparse/empty_sparse_vector_storage.rslib/segment/src/vector_storage/sparse/mmap_sparse_vector_storage.rslib/segment/src/vector_storage/sparse/volatile_sparse_vector_storage.rslib/segment/src/vector_storage/tests/async_raw_scorer.rslib/segment/src/vector_storage/tests/custom_query_scorer_equivalency.rslib/segment/src/vector_storage/tests/test_appendable_dense_vector_storage.rslib/segment/src/vector_storage/tests/test_appendable_multi_dense_vector_storage.rslib/segment/src/vector_storage/tests/test_appendable_sparse_vector_storage.rslib/segment/src/vector_storage/tests/utils.rslib/segment/src/vector_storage/vector_storage_base.rslib/segment/tests/integration/disbalanced_vectors_test.rslib/segment/tests/integration/multivector_filtrable_hnsw_test.rslib/segment/tests/integration/sparse_vector_index_search_tests.rslib/shard/src/optimizers/vacuum_optimizer.rslib/shard/src/query/mmr/lazy_matrix.rslib/shard/src/query/mmr/mod.rs
* [AI] split trait for vector store into read only * fmt * fix: trait import --------- Co-authored-by: Daniel Boros <[email protected]>
Motivation
We are on the quest to implement read-only version of the segment without duplicating any code.
To achive this, we want to use
viewpattern:Viewdata strucure, which would only hold references to actual segment components in a form ofimpl TraitSteps
Separate traits of segment components into Read + everything else
To achieve this, the first step would be to split traits of segment components into
ReadandEverythingElsetraits.The same way as it is done for
IdTrackerReadandIdTracker: IdTrackerReadtraits.This way, we can achieve read-only version of the segment without duplicating any code.
Step 1: Vector Storage (this PR)
ReadandEverythingElsetraits same way as id trackerReadSegmentEntry for Segmentand check that there are no functions used from VectorStorage which are not part ofReadtraitAI summary: