Skip to content

fix(index): keep address-domain indices off replaced fragments - #8084

Merged
wjones127 merged 1 commit into
lance-format:mainfrom
wjones127:fix/addr-domain-index-stale-fragments
Jul 31, 2026
Merged

fix(index): keep address-domain indices off replaced fragments#8084
wjones127 merged 1 commit into
lance-format:mainfrom
wjones127:fix/addr-domain-index-stale-fragments

Conversation

@wjones127

Copy link
Copy Markdown
Contributor

Zone map and bloom filter indices report their matches as physical row addresses (a fragment plus an offset) rather than as row ids, and neither can be remapped when a fragment is rewritten. Under stable row ids, compaction skipped index remapping altogether and just pointed each index's fragment coverage at the fragments it had written. An address-domain index would then be asked to answer queries about data whose addresses it never knew, and the addresses it did return named fragments that compaction had deleted. A filtered scan after compaction failed with fragment 0 referenced by an address-domain index result was not found in the dataset.

The same error site was reachable a second way: an update that replaces every row of a fragment removes that fragment, while the index keeps the addresses it held for it.

This PR makes compaction drop the rewritten fragments from an address-domain index's coverage instead of forwarding the coverage to the new fragments — the index keeps serving whatever the rewrite left alone, and the rewritten data falls back to a full scan. Address-to-row-id translation now also skips a reference to a fragment that is no longer in the dataset, the same way it already skips an address that points at a deleted row: in both cases the row has no live counterpart, so it is not part of any answer.

Both behaviors are specific to stable row ids. Without them an address is the row id, remapping runs (and drops these indices outright), and the sequences above already worked.

Fixes #8076

A zone map or bloom filter index reports matches as physical row addresses,
which a rewrite invalidates, and neither supports remap. Under stable row ids
compaction skipped remapping entirely and simply pointed each index's fragment
bitmap at the fragments it had just written, so the index answered queries with
addresses into fragments that no longer existed. That surfaced as an internal
error from translate_addr_treemap_to_row_ids or, with the addresses pruned, as
a silently empty result.

Compaction now drops the rewritten fragments from an address-domain index's
coverage instead of forwarding it, leaving those fragments to a full scan.
Translation also tolerates a reference to a fragment that is gone: an update
that replaces every row of a fragment removes it while the index keeps the
addresses it held, and those rows have no live counterpart to translate to.

Fixes lance-format#8076

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the bug Something isn't working label Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.61111% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance/src/dataset/transaction.rs 91.66% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@wjones127

Copy link
Copy Markdown
Contributor Author

I think this is a short-term fix. In the long term we should do: #8085

@wjones127
wjones127 marked this pull request as ready for review July 29, 2026 20:47
@wjones127
wjones127 requested a review from westonpace July 29, 2026 20:47

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

I think this is probably even fine as a long-term fix. With seeds it should be really fast to update zone map & bloom filter indexes after the compaction has run. The indexes themselves should also remain reasonably small. So dropping them from the bitmap is probably ok.

@wjones127
wjones127 merged commit 1512594 into lance-format:main Jul 31, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: address-domain scalar index references dropped fragments under stable row ids

2 participants