Skip to content

fix!: bump IVF_RQ version for compatibility check - #6097

Merged
wjones127 merged 4 commits into
mainfrom
yang/add-ivfrq-compatibility-checks
Mar 4, 2026
Merged

wjones127 merged 4 commits into
mainfrom
yang/add-ivfrq-compatibility-checks

Conversation

@BubbleCal

@BubbleCal BubbleCal commented Mar 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add IVF_RQ compatibility tests that run against the latest stable pylance release to ensure read/query compatibility both directions
  • update IndexDetails to report the actual highest vector version rather than a single constant

@github-actions github-actions Bot added the A-python Python bindings label Mar 4, 2026
@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

ACTION NEEDED
Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@BubbleCal BubbleCal changed the title Track vector index versions per type fix: bump IVF_RQ version for compatibility check Mar 4, 2026
@github-actions github-actions Bot added the bug Something isn't working label Mar 4, 2026
@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Review

P1: index_version derived from all old_indices, not just the merged subset

In rust/lance/src/index/append.rs, the new code takes old_indices.iter().map(|idx| idx.index_version).max() over all old indices, but only the last indices_merged entries are being merged. The fragment bitmap correctly scopes to merged_indices, but the version derivation doesn't. While in practice all entries in old_indices should be the same type/version (validated at line 102), using merged_indices.iter() instead of old_indices.iter() would be more precise and consistent with the bitmap logic:

let index_version = merged_indices
    .iter()
    .map(|idx| idx.index_version)
    .max()
    .ok_or_else(|| ...)?;

P1: max_vector_version() manually enumerates all vector types

IndexType::max_vector_version() lists all vector index variants by hand. If a new vector index type is added without updating this list, the max version will be silently wrong. Consider either:

  • Deriving the list from IndexType variants (e.g., using strum or a similar enum iterator), or
  • Adding a compile-time or test assertion that covers all IndexType variants.

Nit: Compat test missing check_write

IvfRqVectorIndex only has check_read — no check_write (unlike the IvfPqVectorIndex test above it). If the intent is to also verify write-path compatibility (append + optimize on an index created by a different version), consider adding it.

@BubbleCal
BubbleCal requested a review from westonpace March 4, 2026 16:01
@BubbleCal BubbleCal changed the title fix: bump IVF_RQ version for compatibility check fix!: bump IVF_RQ version for compatibility check Mar 4, 2026
@Xuanwo

Xuanwo commented Mar 4, 2026

Copy link
Copy Markdown
Member

Hi @BubbleCal, I think the review raised by claude is valid:

index_version derived from all old_indices, not just the merged subset

Do we need to take care about this?

@codecov

codecov Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.42857% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance/src/index.rs 25.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@BubbleCal

Copy link
Copy Markdown
Contributor Author

Hi @BubbleCal, I think the review raised by claude is valid:

index_version derived from all old_indices, not just the merged subset

Do we need to take care about this?

it's common that we just append a delta index and merged_num=0 in that case, so we need to derive index_version from all old_indices.

I think today all old_indices will always be with the same version, even on a new version of lance, we always respect the existing index's version when incremental indexing

@Xuanwo Xuanwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this PR!

When appending to an existing index, the new delta's index_version was
set to max(old_versions), but indices created by old Lance wrote
index_version=0 (unset). This caused the delta to inherit version 0,
making old Lance fall back to brute-force KNN instead of using the index.

Fix by taking max(old_versions, current_library_version_for_type), so the
appended index always declares at least the minimum required version for
its index type.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@wjones127
wjones127 force-pushed the yang/add-ivfrq-compatibility-checks branch from c691663 to 280e9a5 Compare March 4, 2026 20:29

@wjones127 wjones127 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.

Okay this should go good to go. Will merge once CI is green and we can make a release.

@wjones127
wjones127 merged commit 6f48c26 into main Mar 4, 2026
29 checks passed
@wjones127
wjones127 deleted the yang/add-ivfrq-compatibility-checks branch March 4, 2026 21:22
wjones127 added a commit to wjones127/lance that referenced this pull request Mar 4, 2026
Summary
- add IVF_RQ compatibility tests that run against the latest stable
pylance release to ensure read/query compatibility both directions
- update IndexDetails to report the actual highest vector version rather
than a single constant

---------

Co-authored-by: Will Jones <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
westonpace added a commit that referenced this pull request Oct 26, 2026
Fixes three issues flagged on the spec PR:

- Vector: VectorIndexDetails doesn't record the quantization subtype,
  so a released reader's compatibility check accepts any vector
  segment up to the single global max_vector_version() (already 2,
  from IVF_RQ_INDEX_VERSION) for every subtype. Using version 2 for
  FLAT/PQ/SQ/HNSW's new address domain would therefore be silently
  accepted by readers that don't understand it. Use the next unused
  global level, 3, for every subtype instead (see #6097).

- Inverted (FTS): the posting lists in invert.lance hold partition-
  local document IDs assigned at build time, not row ids/addresses --
  a two-pass indirection through docs.lance that the previous wording
  collapsed. Only docs.lance._rowid changes domain; posting-list
  encoding is unaffected by this migration.

- JSON: ZoneMap, BloomFilter, and FM targets are always address-domain
  regardless of version or dataset settings, so a version-0 JSON
  wrapper around one of them is already address-domain today. The
  new floor-version rule only applies to target types that actually
  migrate between domains (BTree, Bitmap, LabelList, and, once
  migrated, NGram, R-Tree, MinHash LSH). Also drops Inverted from the
  example target list, since JSON-path indexes explicitly reject it.

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-python Python bindings breaking-change bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants