Skip to content

make storage generic in ReadOnlySparseVectorStorage - #8964

Merged
generall merged 2 commits into
devfrom
gridstore-storage-generic
May 9, 2026
Merged

generall merged 2 commits into
devfrom
gridstore-storage-generic

Conversation

@generall

@generall generall commented May 9, 2026

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: baf653af-d311-4f51-82a2-def55502441c

📥 Commits

Reviewing files that changed from the base of the PR and between 571806f and b37a402.

📒 Files selected for processing (1)
  • lib/gridstore/src/gridstore/tests.rs

📝 Walkthrough

Walkthrough

This PR generalizes the gridstore and segment storage layers to support pluggable storage backends via the UniversalRead trait. It introduces a generic type parameter S: UniversalRead across gridstore and segment storage, replacing hardcoded MmapFile dependencies. The change renames the existing Tracker type alias to TrackerMmap for clarity, makes GridstoreReader generic over backend types, and propagates the generic parameter through payload and vector storage layers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • qdrant/qdrant#8886: Introduces ReadOnlyPayloadStorage backed by GridstoreReader, which this PR extends to be generic over S: UniversalRead.
  • qdrant/qdrant#8961: Related changes to gridstore/tracker usage and UniversalRead-based I/O paths affecting Tracker/TrackerMmap and tracker header handling.
  • qdrant/qdrant#8894: UniversalRead cleanup and signature changes that affect generic readers and storage types in this PR.

Suggested reviewers

  • coszio
  • xzfc
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate whether the description relates to the changeset. Add a pull request description that explains the motivation, context, and impact of making storage generic in ReadOnlySparseVectorStorage and related types.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'make storage generic in ReadOnlySparseVectorStorage' accurately describes the main change: introducing a generic type parameter to ReadOnlySparseVectorStorage for its storage backend.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gridstore-storage-generic

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/gridstore/src/gridstore/reader.rs`:
- Around line 24-27: The public GridstoreReader type was changed to require an
explicit S type param which breaks existing callers; restore a default by
declaring the generic as S: UniversalRead = common::universal_io::MmapFile (i.e.
GridstoreReader<V, S: UniversalRead = MmapFile>) so the mmap-only path remains
the default, and apply the same pattern to the new public read-only wrapper
types you added (give their S generic a default to MmapFile) so downstream code
remains source-compatible.
🪄 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: 487b71ed-dedf-400d-b7e3-c1ad74f18d10

📥 Commits

Reviewing files that changed from the base of the PR and between 9b2afe2 and 571806f.

📒 Files selected for processing (7)
  • lib/gridstore/src/gridstore/mod.rs
  • lib/gridstore/src/gridstore/reader.rs
  • lib/gridstore/src/lib.rs
  • lib/segment/src/payload_storage/read_only/mod.rs
  • lib/segment/src/payload_storage/read_only/payload_storage_read.rs
  • lib/segment/src/vector_storage/read_only/mod.rs
  • lib/segment/src/vector_storage/sparse/read_only/sparse_vector_storage.rs

Comment on lines +24 to +27
pub struct GridstoreReader<V, S: UniversalRead> {
pub(super) config: StorageConfig,
pub(super) tracker: Tracker,
pub(super) pages: Pages<MmapFile>,
pub(super) tracker: Tracker<S>,
pub(super) pages: Pages<S>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Keep the mmap default on the public reader type.

GridstoreReader is publicly exposed, so adding S here turns the existing mmap-only path into a source break for downstream callers and forces them to import common::universal_io::MmapFile. Giving S a default keeps the new flexibility without making the common case noisier. The same pattern is worth mirroring on the public read-only wrappers added in this PR.

Compatibility shim
-use common::universal_io::{UniversalRead, read_json_via};
+use common::universal_io::{MmapFile, UniversalRead, read_json_via};
...
-#[derive(Debug)]
-pub struct GridstoreReader<V, S: UniversalRead> {
+#[derive(Debug)]
+pub struct GridstoreReader<V, S: UniversalRead = MmapFile> {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub struct GridstoreReader<V, S: UniversalRead> {
pub(super) config: StorageConfig,
pub(super) tracker: Tracker,
pub(super) pages: Pages<MmapFile>,
pub(super) tracker: Tracker<S>,
pub(super) pages: Pages<S>,
pub struct GridstoreReader<V, S: UniversalRead = MmapFile> {
pub(super) config: StorageConfig,
pub(super) tracker: Tracker<S>,
pub(super) pages: Pages<S>,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/gridstore/src/gridstore/reader.rs` around lines 24 - 27, The public
GridstoreReader type was changed to require an explicit S type param which
breaks existing callers; restore a default by declaring the generic as S:
UniversalRead = common::universal_io::MmapFile (i.e. GridstoreReader<V, S:
UniversalRead = MmapFile>) so the mmap-only path remains the default, and apply
the same pattern to the new public read-only wrapper types you added (give their
S generic a default to MmapFile) so downstream code remains source-compatible.

@generall
generall merged commit dc1ec94 into dev May 9, 2026
15 checks passed
@generall
generall deleted the gridstore-storage-generic branch May 9, 2026 12:46
generall added a commit that referenced this pull request May 22, 2026
* make storage generic in ReadOnlySparseVectorStorage

* fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant