Repository navigation
fix(commit): let a deferred rewrite exempt a reindex across processes on untagged FRI tables - #9808
Merged
jackye1995 merged 19 commits intoOct 9, 2026
Conversation
A CreateIndex checks a concurrent deferred-remap Rewrite through the rewrite's in-memory `frag_reuse_index`, but that field is never serialized: a rewrite committed by another process is read back from its transaction file with `frag_reuse_index: None`. On a v0 table the eager rule then applies and any overlap retries, so a reindex running in a different process from compaction (a distributed indexer, for example) loses to every concurrent compaction even with defer_index_remap set. Use the latest manifest's v0 entry as the durable evidence instead, the v0 counterpart of the tagged lineage: a deferred rewrite records every group's source fragments, and fragment ids are never reused, so a rewrite whose groups are all still recorded deferred its remap. Reading the latest entry also closes a hole the in-memory check had: a cleanup can trim the record while an index is being built (it only waits for committed indexes), and an index committed after that kept pointing at the retired fragments with nothing left to translate them. A trimmed record now retries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two more cross-process cases for the v0 deferred-rewrite evidence: a reindex that several deferred compactions committed under, and one whose rewrite group mixes a fragment it covers with one appended after it read the table (the commit leaves that group's output out of its coverage, so the rows are scanned rather than lost). Also move the lineage loader's doc comment back onto it and mention the v0 evidence. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rename `current_v0_reuse_sources` to `untagged_deferred_groups` (and its loader and check to match) and rewrite their docs in plain sentences. The concurrent compaction/reindex tests, old and new, now share one fixture and small helpers instead of repeating the dataset setup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d data An index allowed past a deferred rewrite keeps claiming the source fragments and relies on the reuse index to translate them. Two later changes made that claim stale without anything noticing: an in-place column update on the rewrite's output (the update pruned the output id, which the index does not hold), and a later deferred rewrite folding in an overlay newer than the index (nothing is left to mask the old values). Track which source ids each deferred rewrite's output holds, prune those on an in-place update, and withdraw a group that folded in a newer overlay on an indexed field. The rows are scanned instead. This also fixes the same-process path, which already admitted both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Share `overlay_affects_index` with the query-time rule so a folded overlay on a parent or child of an indexed field counts, judged against each index's own build version. Cut the PR's comments down. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
xuanyu-z
added a commit
to xuanyu-z/lance
that referenced
this pull request
Oct 8, 2026
Use `overlay_affects_index` and `field_affects_index` so an overlay on a parent or child of an indexed field counts, as at query time. The staleness.rs change is identical to the one in lance-format#9808. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…attempt A retry only saw versions committed since the previous attempt, so a change racing the first attempt (an in-place update or a folded overlay on a rewrite it had let through) was checked without that rewrite and the index committed stale coverage. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Letting an index past deferred compactions on an untagged table needs every version since its read version: a version cleanup removed hides the compaction, and an update to its output then goes unwithdrawn. Refuse with a retryable conflict when the window is incomplete. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replaying an index commit from its read version on every attempt dropped pruning an earlier attempt had applied for an update whose version was then cleaned up. Keep the upstream incremental retry and carry where deferred compactions moved the index's rows from attempt to attempt instead; require a complete window per attempt only when the index relies on that history. The workload tests now also run changes during the first commit attempt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…index Rework the untagged path after review: - Find the fragments a compaction output was rewritten from in the latest reuse index on each attempt, instead of carrying a map across commit attempts; nothing has to survive a lost race. - Keep the in-memory reuse update as evidence too, so a same-process build after a trim commits as it did before. - Refuse a version gap only when an index's bitmap covers a recorded group's sources; the MemWAL index and tables without a reuse index are never refused. - Prune updated fragments by id rather than building placeholder fragments. - Move the tests to optimize/tests/concurrent_reindex.rs with one table fixture, one commit hook, and one lookup-versus-scan check, restore the existing compaction/reindex tests, and widen the seeded workloads to overlays, folding compactions and added columns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e session cache Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-less indexes - Refuse a commit over cleaned-up versions only when one is at or after the commit of a recorded compaction of fragments the index covers; an earlier gap touched fragments under their own ids, as without the reuse index. - Expand an in-place update's fields to their descendants, so rewriting a packed struct withdraws an index on one of its children. - Retry when a folded overlay must be withdrawn from an index with no fragment bitmap. - Share each group's sources between its outputs. - Tests: an unrelated gap before the compaction, a packed child, coverage assertions that catch withdrawing too much, and overlays placed on the fragment holding the row the assertions follow rather than on whichever fragment the manifest lists first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ted sources Letting an index past a deferred compaction relies on its source fragments staying unchanged from the build until the compaction read them, as well as on the output after. Restricting the gap check to versions at or after the compaction let a cleaned-up in-place update before it go unseen, and the compaction carried the new values onto an output the index then claimed. Refuse any cleaned-up version in the window again whenever the index covers a recorded compaction's sources. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rred compaction Co-Authored-By: Claude Opus 5.5 <[email protected]>
jackye1995
approved these changes
Oct 9, 2026
jackye1995
pushed a commit
to xuanyu-z/lance
that referenced
this pull request
Oct 9, 2026
Use `overlay_affects_index` and `field_affects_index` so an overlay on a parent or child of an indexed field counts, as at query time. The staleness.rs change is identical to the one in lance-format#9808. Co-Authored-By: Claude Opus 5.5 <[email protected]>
brendanclement
added a commit
to brendanclement/lance
that referenced
this pull request
Oct 12, 2026
Since lance-format#9808, an index build that rebases past a deferred compaction finds the compaction recorded in the latest manifest's fragment reuse index, so it does not retry when it sees the rewrite decoded from storage. On a stable-row-ID table a zone map now commits on its first attempt and a bitmap is refused there by the publication check. Also check that a committed race keeps every row's stable row ID and maps its old address to the new one, and that a refused one leaves the table as the first commit published it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
defer_index_remap, a compaction does not remap indexes, so an index built concurrently should commit past it. On a table whose fragment reuse index (FRI) is untagged (index_version0), that only works from the process that ran the compaction. The exemption readsRewrite.frag_reuse_index, which is never serialized to the transaction file, so a build in any other process fails withpreempted by concurrent transaction Rewrite.Fix. The CreateIndex rebase also loads the latest manifest's untagged FRI. A rewrite counts as deferred if it carries the in-memory update (as before) or if the FRI records all of its groups, matched by source fragment ids, which are never reused.
Letting a build past a compaction means its coverage of the compacted fragments must stay valid. Two changes can invalidate it, and both now withdraw coverage instead of committing stale entries:
overlay_affects_index). It now also applies to a rewrite from the same process. An index with no fragment bitmap retries instead.The index's source fragments must also stay unchanged from the build until the compaction reads them. A version cleaned up from the commit window could hide a change to them, or to the compaction's output. So if the index covers a recorded compaction's sources, any missing version refuses the commit with a retryable conflict. Other indexes and tables keep their current behavior.
If the FRI record is trimmed between two commit attempts, the index commits with coverage nothing translates. Those rows are scanned, as an in-process build did before.
Tests are in
optimize/tests/concurrent_reindex.rs. Each scenario commits a build from another process (and from the same process where it differs), then compares index lookups against a scan:Seeded workloads of appends, deletes, updates, overlays, compactions, added columns and the remap job also run before and during the commit. Each change was checked against the test that should catch it.
@LuQQiu: the untagged path stays separate from the tagged per-group loop, following the existing split.