Skip to content

fix(index): drop stale scalar index entries after stable-row-id update#7359

Open
wkalt wants to merge 1 commit into
lance-format:mainfrom
wkalt:ticket/gen-640/stale-scalar-index-stable-rowid-update
Open

fix(index): drop stale scalar index entries after stable-row-id update#7359
wkalt wants to merge 1 commit into
lance-format:mainfrom
wkalt:ticket/gen-640/stale-scalar-index-stable-rowid-update

Conversation

@wkalt

@wkalt wkalt commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Under stable row ids an update deletes a row's old copy and rewrites it to a new fragment under the same row id. optimize_indices kept the old value->row_id entry, so queries for the old value returned the updated row and BTree optimize errored ("from_sorted_iter called with non-sorted input").

  • build_stable_row_id_filter now subtracts each fragment's deletion vector so the old-row allow-list holds only live rows (fixes BTree).
  • BitmapIndex::update applies that filter to old postings via OldIndexDataFilter::retain_old_rows.
  • optimize routes FTS through InvertedIndex::merge_segments (which filters old partitions) instead of the reference-only update path.

Adds a regression test covering all three index types.

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer bug Something isn't working labels Jun 18, 2026
Under stable row ids an update deletes a row's old copy and rewrites it to
a new fragment under the same row id. optimize_indices kept the old
value->row_id entry, so queries for the old value returned the updated row
and BTree optimize errored ("from_sorted_iter called with non-sorted
input").

- build_stable_row_id_filter now subtracts each fragment's deletion vector
  so the old-row allow-list holds only live rows (fixes BTree).
- BitmapIndex::update applies that filter to old postings via
  OldIndexDataFilter::retain_old_rows.
- optimize routes FTS through InvertedIndex::merge_segments (which filters
  old partitions) instead of the reference-only update path.

Adds a regression test covering all three index types.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wkalt wkalt force-pushed the ticket/gen-640/stale-scalar-index-stable-rowid-update branch from 8ff2484 to 3d26238 Compare June 18, 2026 15:32
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.81159% with 48 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance/src/index/append.rs 75.75% 39 Missing and 1 partial ⚠️
rust/lance-index/src/scalar/bitmap.rs 78.37% 5 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant