Skip to content

refactor(index): pass index_version into ScalarIndexPlugin::load_index - #9518

Merged
westonpace merged 4 commits into
mainfrom
feat/index-version-in-load
Oct 5, 2026
Merged

westonpace merged 4 commits into
mainfrom
feat/index-version-in-load

Conversation

@westonpace

@westonpace westonpace commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

The load_index method had no visibility into the index version. This made it impossible
to change index behavior based on the version when opening an index. This could be worked
around by always modifying the proto when you modify the version. However, that leads to
some redundancy and it seems easier to just let the load_index method see the version.

BREAKING CHANGE: This is technically a minor breaking change since a public trait (the index trait) is being modified and so any downstream implementers (none that I know of) would be affected.


Stack created with GitHub Stacks CLI • Give Feedback 💬

@westonpace
westonpace added this pull request to stack #9519 September 23, 2026 16:29
@github-actions github-actions Bot added the A-index Vector index, linalg, tokenizer label Sep 23, 2026

@lance-gatekeeper lance-gatekeeper 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.

❌ Gate recommendation: request changes.

Passing each segment's persisted version to its scalar loader is a sound way to support format-aware reads without changing ordinary index storage. Please complete the in-tree trait migration so the crate builds. The JSON wrapper also needs the target's actual format version before the stacked BTree format change relies on it.

Please mark this PR with the breaking-change label.

&self,
index_store: Arc<dyn IndexStore>,
index_details: &prost_types::Any,
index_version: u32,

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.

This new argument leaves MinHashLshIndexPlugin::load_index at the old signature, so lance-index cannot build. The call in rust/lance-index/benches/btree.rs:203 also still omits the version; please update both sites. Reproducer run on this head: cargo check -p lance-index --tests --benches. It should complete, but fails with E0050: method load_index has 5 parameters but ... trait ... has 6 in the MinHash LSH plugin.

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.

The migration still prevents lance-index from building at e51388c. The new load_index_with_remapping argument also needs to be added to the Bitmap, BloomFilter, BTree, Inverted, LabelList, NGram, and ZoneMap overrides. The geo-gated RTree override has the same old signature. MinHash LSH and the BTree benchmark call noted above remain unchanged.

Reproducer run on this head with Rust 1.98.1: cargo check -p lance-index --tests --benches. Expected: success. Observed: eight E0050 errors in the default build, covering MinHash LSH and the seven remapping overrides. Complete both loader signature migrations and the remaining call site.

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.

Fixed in d06342c: the reported loader signatures, including the remapping overrides, and the BTree benchmark call are updated. cargo check -p lance-index --tests --benches now completes successfully with Rust 1.98.1.

.load_index(
index_store,
target_details,
target_plugin.version(),

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.

version() is the target plugin's maximum supported format, not the format persisted for this nested index. Those already differ for default Inverted indexes (written as V2 while the plugin advertises V3). Current loaders ignore the new argument, but the stacked BTree change uses it to distinguish stored row IDs from addresses: an existing JSON/BTree target written as V0 would be passed V1. Preserve or infer the target's own version before that change begins using this value.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Sep 23, 2026
@westonpace
westonpace force-pushed the feat/index-version-in-load branch 2 times, most recently from 5f1254c to fab0ebc Compare September 23, 2026 17:13
@westonpace
westonpace force-pushed the feat/index-version-in-load branch from fab0ebc to e60702c Compare September 23, 2026 19:07
Base automatically changed from feat/defer-index-remap-stable-row-ids to main October 5, 2026 16:52
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Oct 5, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Oct 5, 2026
@westonpace
westonpace force-pushed the feat/index-version-in-load branch from e60702c to e51388c Compare October 5, 2026 17:00
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Oct 5, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Oct 5, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Oct 5, 2026
westonpace and others added 3 commits October 5, 2026 11:10
Thread the segment's own persisted IndexMetadata::index_version through
load_index (the only caller, open_scalar_index, already has it). Every
plugin ignores the new parameter for now -- none has more than one
on-disk format yet -- except JsonIndexPlugin, which forwards its target
plugin's own current version rather than its own (JsonIndexDetails does
not yet record the target's actual version; every target it builds
comes from a fresh training pass in this codebase, so this is accurate
today).

Pure plumbing: no plugin's behavior changes. Lays the groundwork for a
plugin whose on-disk format has changed over time (e.g. which domain a
stored row identifier is in) to read an older segment correctly instead
of reinterpreting it under the newest format.
Several load_index/load_index_with_remapping overrides were not updated
for the new index_version parameter added to the trait, breaking the
build. Also applies cargo fmt to the affected call sites.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
A test literal still used the old conflicting_frag_reuse_indices field
name after it was renamed to frag_reuse_base in #9620, breaking the
build for every PR rebased onto main.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@westonpace
westonpace force-pushed the feat/index-version-in-load branch from d06342c to b54470b Compare October 5, 2026 18:18
@lance-gatekeeper lance-gatekeeper Bot removed K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. labels Oct 5, 2026

@lance-gatekeeper lance-gatekeeper 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.

⚠️ Gate recommendation: approve with a non-blocking risk.

The loader migration remains complete after rebasing onto the current base. Passing each segment's persisted version to both loader entry points provides the needed format context without changing current readers' behavior.

The JSON target-version risk remains non-blocking here because current readers ignore the argument. For dependent #9481, preserve or infer the nested target's stored version before using it to distinguish row IDs from addresses.

@lance-gatekeeper lance-gatekeeper Bot added K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk. and removed K-risk Latest Gatekeeper recommendation includes a non-blocking risk. K-approved Latest Gatekeeper recommendation permits acceptance. labels Oct 5, 2026
@westonpace
westonpace merged commit 75d9007 into main Oct 5, 2026
@westonpace
westonpace deleted the feat/index-version-in-load branch October 5, 2026 18:37
westonpace added a commit that referenced this pull request Oct 5, 2026
Another in-flight PR added this call site against the pre-#9518
load_index signature; the squash-merge landed it without the new
index_version parameter, breaking main's build.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
westonpace added a commit that referenced this pull request Oct 28, 2026
## Summary
- Follow-up to #9518 (merged). Addresses the non-blocking risk the
gatekeeper flagged there: `JsonIndexPlugin::load_index` passed
`target_plugin.version()` (the target plugin's current max format
version) instead of the version the target index was actually persisted
at, since `JsonIndexDetails` never recorded it.
- Adds an optional `target_index_version` field (field 4) to
`JsonIndexDetails`, populated from `CreatedIndex::index_version`
whenever the wrapper trains, remaps, or updates its target. `load_index`
now reads it, falling back to the target plugin's current version only
for details written before this field existed (matching the previous,
safe-for-now behavior for old data).
- Drops the now-stale note in the `target_data_type` docs saying these
details do not record the target's format version.
- This matters for the stacked [BTree format
change](#9481), which will use
the passed-in version to distinguish stored row IDs from row addresses.

## Test plan
- `cargo clippy -p lance-index -p lance --tests -- -D warnings` clean
- `cargo fmt --all -- --check` clean
- `cargo test -p lance-index --lib scalar::json::` — 27 passed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_018BsnoP9ZPMX6vhJSygzdnN

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer breaking-change K-approved Latest Gatekeeper recommendation permits acceptance. K-risk Latest Gatekeeper recommendation includes a non-blocking risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants