Skip to content

feat: add open for read only map index - #9223

Merged
dancixx merged 4 commits into
devfrom
feat/readonly-map-index-open
Jun 2, 2026
Merged

dancixx merged 4 commits into
devfrom
feat/readonly-map-index-open

Conversation

@dancixx

@dancixx dancixx commented May 28, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

⚠️ PRs must target the dev branch. If your PR targets master, please change the base branch to dev before requesting a review.

  • My PR targets the dev branch (not master) and my branch was created from dev.
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change adds read-only lifecycle support for map indices. ReadOnlyAppendableMapIndex::open opens a Gridstore-backed index in read-only mode, returns Ok(None) if the directory is missing, rebuilds MutableMapIndexInner by iterating stored entries while tracking IO counters, and retains the GridstoreReader. ReadOnlyMapIndex gains open_appendable (delegates to the appendable opener), open_immutable (opens mmap-backed indices with effective on-disk logic), and get_mutability_type. Module docs and an integration test exercising appendable round-trip opening and queries were added.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • qdrant/qdrant#9020: Introduced the ReadOnlyAppendableMapIndex skeleton that this PR completes with the open constructor.
  • qdrant/qdrant#9256: Related refactor of UniversalMapIndex::open and its filesystem-backed not-found semantics used by the immutable opener.
  • qdrant/qdrant#8828: Mmap-backed map index reopen that required passing a deleted_points mask, which matches the open_immutable signature here.

Suggested labels

release:1.18.0

Suggested reviewers

  • generall
  • coszio

Poem

I’m a rabbit with a tiny key, 🐇🔑
I open maps read-only, careful as can be,
Gridstore hums while mmap dreams deep,
Inner state rebuilt for data to keep,
Hop, index, hop — safe and free!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding an open method for the read-only map index, which is the primary objective across all file modifications.
Description check ✅ Passed The description is related to the changeset, covering the required checklists and confirming that tests pass, code is formatted, and clippy checks completed. It indicates the intent to add read-only map index opening support.
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.


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.

@dancixx
dancixx marked this pull request as draft May 28, 2026 14:23
Base automatically changed from feat/gridstore-readonly-open to dev May 28, 2026 20:34
@dancixx
dancixx marked this pull request as ready for review May 29, 2026 11:49
@dancixx
dancixx requested a review from generall May 29, 2026 11:50

@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/segment/src/index/field_index/map_index/mutable_map_index/read_only/lifecycle.rs`:
- Around line 47-59: The code currently calls storage.iter::<_,
GridstoreError>(...) and then .unwrap(), which incorrectly assumes iteration
cannot return I/O errors; replace the unwrap with proper error
propagation/handling so GridstoreError is returned to the caller instead of
panicking. Concretely, have the surrounding function return a Result and
propagate the Result from storage.iter (use ? or map_err) so failures from
GridstoreReader::iter are surfaced; keep the existing callback that calls
inner.ingest and the hw_counter.ref_payload_index_io_write_counter() argument
unchanged, and ensure max_point_offset() semantics are preserved while changing
the call site to propagate the iteration error.
🪄 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: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: ddef0a9f-c1f0-4c15-8d75-697f094ff010

📥 Commits

Reviewing files that changed from the base of the PR and between 47cfd37 and 40caf94.

📒 Files selected for processing (9)
  • lib/gridstore/src/gridstore/mod.rs
  • lib/gridstore/src/gridstore/reader.rs
  • lib/gridstore/src/gridstore/tests.rs
  • lib/gridstore/src/pages.rs
  • lib/gridstore/src/tracker.rs
  • lib/segment/src/index/field_index/map_index/mutable_map_index/read_only/lifecycle.rs
  • lib/segment/src/index/field_index/map_index/mutable_map_index/read_only/mod.rs
  • lib/segment/src/index/field_index/map_index/read_only/lifecycle.rs
  • lib/segment/src/index/field_index/map_index/read_only/mod.rs

@generall generall added this to the Live-reload milestone May 30, 2026
@generall

generall commented Jun 1, 2026

Copy link
Copy Markdown
Member

rebase on top of #9256 please

@dancixx
dancixx force-pushed the feat/readonly-map-index-open branch from 40caf94 to 053b476 Compare June 2, 2026 08:30
@dancixx
dancixx force-pushed the feat/readonly-map-index-open branch from e0912f1 to 38549c9 Compare June 2, 2026 08:59
generall and others added 2 commits June 2, 2026 11:57
…open

Replace the path.exists() pre-check in the read-only appendable map index
open path with error-driven detection through ok_not_found(). Generalize
OkNotFound over an IsNotFound trait, implemented for io::Error, mmap::Error,
UniversalIoError, and GridstoreError so a NotFound surfacing through any
layer (including mmap's inner io::Error) maps to Ok(None).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@dancixx
dancixx merged commit 4d19a01 into dev Jun 2, 2026
16 checks passed
@dancixx
dancixx deleted the feat/readonly-map-index-open branch June 2, 2026 11:56
timvisee pushed a commit that referenced this pull request Jun 3, 2026
* feat: add open methods for map

* fix: review comments

* feat: detect not-found via error instead of path.exists in map index open

Replace the path.exists() pre-check in the read-only appendable map index
open path with error-driven detection through ok_not_found(). Generalize
OkNotFound over an IsNotFound trait, implemented for io::Error, mmap::Error,
UniversalIoError, and GridstoreError so a NotFound surfacing through any
layer (including mmap's inner io::Error) maps to Ok(None).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* review: revert internal error conversion

---------

Co-authored-by: generall <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Jul 3, 2026
9 tasks done
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.

2 participants