Skip to content

feat: support FRI and stable row ids as long as there are no row-id-domain indexes - #9453

Closed
westonpace wants to merge 5 commits into
lance-format:mainfrom
westonpace:feat/defer-index-remap-stable-row-ids
Closed

westonpace wants to merge 5 commits into
lance-format:mainfrom
westonpace:feat/defer-index-remap-stable-row-ids

Conversation

@westonpace

Copy link
Copy Markdown
Member

The combination of stable row ids, the FRI, and indexes that store row ids is invalid. We want to eventually move away from row-id-domain indexes.

The current enforcement, however, prevents deferred compaction if there are stable row ids. We need to loosen this check slightly, so that we allow deferred compaction as long as we don't have row-id-domain indexes.

This means we also have to prevent the creation of row-id-domain indexes if there is an FRI.

westonpace and others added 4 commits September 21, 2026 05:59
Compaction refused `defer_index_remap` on a stable-row-id dataset on the
grounds that stable row ids need no remapping. That holds for the
row-id-domain indices, but not for the address-domain ones: a zone map or
bloom filter is built over `_rowaddr`, and a rewrite moves every address it
stores. With nothing to repair those addresses, the rewritten fragments were
dropped from such an index's coverage and the scanner fell back to a full
scan -- correct answers, but the index stopped earning its keep.

Allow the two together so the fragment-reuse index can carry the repair:

- Capture row addresses whenever a deferred remap is requested rather than
  only when row ids are unstable.
- Rechunk stable row ids *and* resolve the captured addresses in the rewrite
  task. These sat in mutually exclusive branches, so capturing addresses
  would otherwise skip `rechunk_stable_row_ids`. Stable row ids are captured
  sequence-style, so only the row-id index knows the address each one sat at.
- Let an address-domain index follow its data to the new fragments when the
  commit carries an FRI, instead of dropping the rewritten fragments.

Narrow the rejection rather than removing it. An FRI is applied to every
index on load, and with stable row ids the two domains diverge: a stable row
id is numerically indistinguishable from an address into fragment 0, so an
FRI applied to a btree would silently rewrite valid row ids rather than fail.
The two therefore cannot coexist on a stable-row-id dataset, and both sides
now refuse to create the pair:

- Compaction rejects a deferred remap while a row-id-domain index is present,
  at the plan boundary and again at the commit boundary, since a caller may
  supply its own planner or commit a plan made before the index existed.
- `create_index` rejects a row-id-domain index while a non-empty FRI is
  present. An unclassifiable type is refused rather than allowed.

Both classifiers treat an unknown type as row-id-domain, so a type missing
from either list costs a refused operation, never silent corruption.

This restriction drops out once every index stores row addresses.

Co-Authored-By: Claude Opus 5 <[email protected]>
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Sep 21, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 21, 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.

The deferred-remap path now preserves address-domain index coverage while rejecting stable-row-ID/FRI combinations with row-ID-domain indices at both request and commit boundaries. The prior alias and concurrent-commit gaps are closed, including both race orderings.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 21, 2026
@westonpace westonpace closed this Sep 23, 2026
@westonpace
westonpace deleted the feat/defer-index-remap-stable-row-ids branch September 23, 2026 16:17
@westonpace

Copy link
Copy Markdown
Member Author

This was replaced by #9514 which is now part of a stack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant