Skip to content

Universal IO: gridstore pages - #8223

Merged
generall merged 3 commits into
devfrom
universal-io-gridstore
Feb 25, 2026
Merged

generall merged 3 commits into
devfrom
universal-io-gridstore

Conversation

@generall

Copy link
Copy Markdown
Member
  • [manunal] Gridstore page use universal IO
  • fmt

@generall
generall requested a review from coszio February 24, 2026 23:35
coderabbitai[bot]

This comment was marked as resolved.

@generall generall added this to the Universal IO milestone Feb 24, 2026
@qdrant qdrant deleted a comment from coderabbitai Bot Feb 25, 2026
@generall
generall requested a review from ffuugoo February 25, 2026 09:48
Comment on lines +105 to +107
fn len(&self) -> crate::universal_io::Result<u64> {
Ok(self.mmap.len() as u64)
}

@ffuugoo ffuugoo Feb 25, 2026 •

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.

Nit: Can we use super::Result and just do Result instead of crate::universal_io::Result in this file?

Comment thread lib/gridstore/src/gridstore.rs Outdated
Comment on lines +272 to +279
let Some(ValuePointer {
page_id,
block_offset,
length,
} = self.get_pointer(point_offset)?;
}) = self.get_pointer(point_offset)
else {
return Ok(None);
};

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.

Suggested change
let Some(ValuePointer {
page_id,
block_offset,
length,
} = self.get_pointer(point_offset)?;
}) = self.get_pointer(point_offset)
else {
return Ok(None);
};
let Some(pointer) = self.get_pointer(point_offset) else {
return Ok(None);
};
let ValuePointer {
page_id,
block_offset,
length,
} = pointer;

Comment thread lib/gridstore/src/gridstore.rs Outdated
Comment on lines +468 to +475
let Some(ValuePointer {
page_id,
block_offset,
length,
} = self.tracker.write().unset(point_offset)?;
let raw = self.read_from_pages::<false>(page_id, block_offset, length);
}) = self.tracker.write().unset(point_offset)
else {
return Ok(None);
};

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.

Suggested change
let Some(ValuePointer {
page_id,
block_offset,
length,
} = self.tracker.write().unset(point_offset)?;
let raw = self.read_from_pages::<false>(page_id, block_offset, length);
}) = self.tracker.write().unset(point_offset)
else {
return Ok(None);
};
let Some(pointer) = self.tracker.write().unset(point_offset) else {
return Ok(None);
};
let ValuePointer {
page_id,
block_offset,
length,
} = pointer;

Comment thread lib/gridstore/src/gridstore.rs Outdated
mut callback: F,
hw_counter: HwMetricRefCounter,
) -> std::result::Result<(), E>
) -> std::result::Result<(), Either<E, GridstoreError>>

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.

Would where E: From<GridstoreError> work here? This way we can get rid of Either, ? would work on GridstoreError.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Unfortunatelly no, this error is propagated from crates and there are not guaranteed to be compatible with Gridstore error in any way

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.

I mean, it's callback, so we can require it to be compatible. Or the other way round, make it where GridstoreError: From<E> and then if you modify code that require new error subtype in GridstoreError, you just add it.

@ffuugoo ffuugoo Feb 25, 2026 •

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.

where E: From<GridstoreError> works fine

UPD: Didn't notice you already implemented that in #8230 lol

* Apply review feedback from PR #8223

- Use `super::Result` import in mmap.rs instead of fully-qualified `crate::universal_io::Result`
- Restructure ValuePointer destructuring in get_value and delete_value to
  first match Some(pointer), then destructure separately

* Replace Either<E, GridstoreError> with E: From<GridstoreError> in Gridstore::iter

Use a trait bound instead of Either to combine callback and gridstore
errors, allowing `?` to work directly on GridstoreError. This simplifies
callers by removing Either matching and io::Error conversion workarounds.

---------

Co-authored-by: qdrant-claw <[email protected]>
@generall
generall merged commit 03c0fa2 into dev Feb 25, 2026
13 checks passed
@generall
generall deleted the universal-io-gridstore branch February 25, 2026 18:46
@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c3b4b8 and 7db46b1.

📒 Files selected for processing (15)
  • lib/common/common/src/universal_io/mmap.rs
  • lib/common/common/src/universal_io/mod.rs
  • lib/gridstore/benches/bustle_bench/payload_storage.rs
  • lib/gridstore/benches/random_data_bench.rs
  • lib/gridstore/benches/real_data_bench.rs
  • lib/gridstore/src/error.rs
  • lib/gridstore/src/gridstore.rs
  • lib/gridstore/src/page.rs
  • lib/segment/src/common/operation_error.rs
  • lib/segment/src/index/field_index/full_text_index/mutable_text_index.rs
  • lib/segment/src/index/field_index/geo_index/mutable_geo_index.rs
  • lib/segment/src/index/field_index/map_index/mutable_map_index.rs
  • lib/segment/src/index/field_index/numeric_index/mutable_numeric_index.rs
  • lib/segment/src/payload_storage/mmap_payload_storage.rs
  • lib/segment/src/vector_storage/sparse/mmap_sparse_vector_storage.rs

📝 Walkthrough

Walkthrough

This pull request refactors the universal I/O abstraction and storage layer to use Result-based error handling throughout. Key changes include: converting MmapUniversal and UniversalRead/UniversalWrite trait methods from direct returns to Result types; making Page generic over a UniversalWrite implementation instead of concrete mmap usage; adding a len() method to UniversalRead; adding UniversalIoError variant to GridstoreError; updating Gridstore methods (read_from_pages, get_value, delete_value, write_into_pages, populate) to return Results and propagate errors; and propagating error handling through storage indices (mutable text index, geo index, map index, numeric index, mmap payload storage, sparse vector storage).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • universal io mmap #8196: Directly continues and modifies the MmapUniversal implementation, updating method signatures, error types, and behaviors introduced in that PR.
  • Universal I/O #8183: Introduced the foundational Universal I/O abstraction that this PR extends with Result-based error handling and trait method additions.
  • [gridstore] use seq mmap in iter #6750: Modifies the same gridstore and page read paths with const-generic READ_SEQUENTIAL patterns that are central to this refactoring.

Suggested reviewers

  • coszio
  • timvisee
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch universal-io-gridstore

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

generall added a commit that referenced this pull request Mar 26, 2026
* [manunal] Gridstore page use universal IO

* fmt

* Apply review feedback for universal IO gridstore pages (#8230)

* Apply review feedback from PR #8223

- Use `super::Result` import in mmap.rs instead of fully-qualified `crate::universal_io::Result`
- Restructure ValuePointer destructuring in get_value and delete_value to
  first match Some(pointer), then destructure separately

* Replace Either<E, GridstoreError> with E: From<GridstoreError> in Gridstore::iter

Use a trait bound instead of Either to combine callback and gridstore
errors, allowing `?` to work directly on GridstoreError. This simplifies
callers by removing Either matching and io::Error conversion workarounds.

---------

Co-authored-by: qdrant-claw <[email protected]>

---------

Co-authored-by: qdrant-claw <[email protected]>
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* [manunal] Gridstore page use universal IO

* fmt

* Apply review feedback for universal IO gridstore pages (#8230)

* Apply review feedback from PR #8223

- Use `super::Result` import in mmap.rs instead of fully-qualified `crate::universal_io::Result`
- Restructure ValuePointer destructuring in get_value and delete_value to
  first match Some(pointer), then destructure separately

* Replace Either<E, GridstoreError> with E: From<GridstoreError> in Gridstore::iter

Use a trait bound instead of Either to combine callback and gridstore
errors, allowing `?` to work directly on GridstoreError. This simplifies
callers by removing Either matching and io::Error conversion workarounds.

---------

Co-authored-by: qdrant-claw <[email protected]>

---------

Co-authored-by: qdrant-claw <[email protected]>
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.

3 participants