Skip to content

feat: enable the fragment reuse index on stable row id datasets - #9120

Merged
westonpace merged 1 commit into
lance-format:mainfrom
brendanclement:brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled
Sep 29, 2026
Merged

westonpace merged 1 commit into
lance-format:mainfrom
brendanclement:brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled

Conversation

@brendanclement

@brendanclement brendanclement commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Part of the stable row ID GA work in §5.1. Adds validation for stable-row-ID datasets that carry a Fragment Reuse Index (FRI).

Allows the combination when there are no ordinary indexes, or every index uses a supported format, stores physical row addresses, and applies FRI mappings. Today, ZoneMap and BloomFilter qualify. Stable-ID indexes, JSON indexes, and unrecognized types or versions are rejected.

Validates the full index list before publishing a table version, including clone, restore, and rebased commits. Readers exclude incompatible indexes from query planning, and direct loads refuse to apply FRI mappings to them. Index creation uses the same compatibility rules.

Sets the reader and writer feature flag from #9119 per table version. Support remains debug-only, release builds refuse to publish the combination. This PR does not enable deferred compaction on stable-row-ID datasets.

Next steps

  • Record mappings during opted-in compaction on eligible stable-row-ID datasets, including datasets without indexes.
  • Once an FRI exists, record every subsequent compaction and prevent concurrent compactions from losing mappings.
  • Preserve mapping history during cleanup and measure the cost before production rollout.
  • Enable release support once those protections are complete. Coordinate with westonpace on the rollout

@github-actions github-actions Bot added A-python Python bindings A-index Vector index, linalg, tokenizer A-format On-disk format: protos and format spec docs format-change A change to the format spec, which requires a vote. Remove if minor (e.g. fixing typo). enhancement New feature or request labels Sep 10, 2026
@brendanclement
brendanclement force-pushed the brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled branch 2 times, most recently from ec31dd7 to 1b17fdc Compare September 10, 2026 17:05
@brendanclement
brendanclement force-pushed the brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled branch 5 times, most recently from 404d41e to 6222bf0 Compare September 16, 2026 22:00
@brendanclement
brendanclement marked this pull request as ready for review September 16, 2026 22:02
@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Format specification vote

This PR modifies the Lance format specification, so it requires 3 binding +1 votes from PMC members (excluding the proposer), at least one of them on the latest commit, and a minimum 72-hour voting period, weekends excluded, before it can merge. Vote by approving this PR (+1) or requesting changes (−1, a veto). See the voting process.

Approvals carry over across pushes, so a rebase or a typo fix does not send everyone back to re-vote. Whoever approves the latest commit is vouching that nothing substantive has changed since the earlier approvals; if something has, ask for fresh votes.

Status: ❌ Blocked — 0 of 3 required approvals

Approvals none (0/3)
Latest commit approved by none — one PMC member must approve the latest commit
Vetoes none
Voting period ends Mon 2026-09-21 22:02 UTC (15:02 PDT)

Updated automatically by the format-spec vote gate, which re-checks every 15 minutes — just voted? Re-check now (press Run workflow; leave the input blank to re-check every open format PR). A PMC member may apply the format-waived label to waive the vote for a trivial edit (typo, wording, formatting).

lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Sep 16, 2026
@brendanclement
brendanclement force-pushed the brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled branch from 6222bf0 to a70d498 Compare September 18, 2026 16:34
@github-actions github-actions Bot added the A-docs Documentation label Sep 18, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 18, 2026
Comment thread docs/src/guide/performance.md Resolved
@westonpace westonpace added the format-waived Author attests no format vote is needed label Sep 18, 2026
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 18, 2026
@brendanclement
brendanclement force-pushed the brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled branch from a70d498 to 09c42ce Compare September 18, 2026 17:57
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 18, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 18, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 18, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 18, 2026

@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 we independently tackled some of the same space (I just created #9453).

I think this PR is maybe a bit more complex than it needs to be. We are hoping to move all indexes to be address domain indexes going forwards. So we can treat row id indexes as a sort of temporary state that we don't have to support that solidly.

For example, this PR jumps through a lot of hoops to try and figure out if a JSON index is a row address or row id index. We can just hardcode row-id for now (a conservative default) and wait until all the other indexes have switched to row address and then assume the JSON index is also a row address index at that point.

Also, instead of trying to make FRI & row-id domain indexes compatible we can just reject the FRI/SRID/row-id-domain index combination entirely (since we will migrate away from it). So some of these changes in frag_reuse.rs and manifest_build.rs might be overkill.

@brendanclement
brendanclement force-pushed the brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled branch from 670460d to 0884479 Compare September 25, 2026 17:20
@brendanclement
brendanclement marked this pull request as draft September 25, 2026 17:20
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 25, 2026
@brendanclement
brendanclement marked this pull request as ready for review September 25, 2026 17:27

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

This revision adopts the conservative boundary discussed in the maintainer review: stable-row-ID tables with an FRI admit only supported physical-address indices that apply the mapping. Publication rejects incompatible indices, and readers exclude them from query planning. The feature remains debug-only while deferred compaction recording and retention are completed in follow-up work.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 25, 2026
@brendanclement
brendanclement force-pushed the brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled branch from 0884479 to 4529044 Compare September 26, 2026 03:50
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 26, 2026
Groundwork for the fragment reuse index on stable-row-ID tables. An index
whose entries are stable row ids would have them rewritten as addresses, so
such a table may only carry indices this build can prove store row addresses
and apply the fragment reuse index (today ZoneMap and BloomFilter).

- write_manifest_file validates the full manifest and index list, covering
  normal, retried and detached commits, clones and restore, and derives
  FLAG_FRAG_REUSE_WITH_STABLE_ROW_IDS for every version.
- The flag is supported only in debug builds, and release builds refuse to
  publish the combination, until continuous recording and retention land.
- Readers hide indices that cannot be proven compatible, and the shared
  remapper refuses to hand them the fragment reuse index.
- create_index refuses vector and full-text requests before training and
  judges scalar requests on the index built.
- The stable-row-ID rewrite no longer recalculates the fragment reuse index's
  own bitmap.

Compaction still refuses defer_index_remap on stable-row-ID tables.
@brendanclement
brendanclement force-pushed the brendanclement/oss-2189-enable-fragment-reuse-index-even-when-srid-is-enabled branch from 4529044 to 49b431b Compare September 29, 2026 16:30
brendanclement added a commit to brendanclement/lance that referenced this pull request Sep 29, 2026
…-ID tables

Depends on the two commits below it:
- feat: validate stable-row-ID tables that carry a fragment reuse index
  (lance-format#9120), for the eligibility check and the
  debug-only gate;
- fix: exact FRI watermark for retention, remap and segment merge, so
  that an index built before a recorded rewrite publishes keeps the
  mapping it needs once its coverage follows the rewrite.

A deferred compaction (defer_index_remap) on a stable-row-ID table now
records its row-address moves in the fragment reuse index, including on
tables with no indices and for groups no index covers. Release builds
still refuse the option there.

- The planner accepts the option only if every index passes the
  eligibility check, and names each offending index otherwise. It also
  refuses a table whose manifest still requires a tagged fragment reuse
  history, which stable row IDs exclude.
- Recording tasks take the moved rows' old addresses from fragment
  metadata and deletion vectors. They refuse task fragments out of id
  order and a live-row count that disagrees with the rewrite. Row
  lineage is placed for every stable-row-ID task, recording or not.
- The commit records when the option is set or when every task
  recorded, so a commit without options keeps the moves and normalizes
  the source fragments the same way. Mixed tasks,
  or the option with tasks that recorded nothing, are refused before
  any fragment id is reserved, and eligibility is checked again against
  the commit handle.
- When a stable-row-ID rewrite carries a fragment reuse index, address
  indices keep their coverage and readers translate through it. Without
  one they drop the rewritten fragments as before.

Tables without stable row IDs, and stable-row-ID compactions without
the option, behave as before.
@brendanclement

Copy link
Copy Markdown
Contributor Author

Rebased based on the latest main with CI fixes

@westonpace
westonpace merged commit c4c26da into lance-format:main Sep 29, 2026
37 checks passed
brendanclement added a commit to brendanclement/lance that referenced this pull request Sep 29, 2026
…-ID tables

Depends on the two commits below it:
- feat: validate stable-row-ID tables that carry a fragment reuse index
  (lance-format#9120), for the eligibility check and the
  debug-only gate;
- fix: exact FRI watermark for retention, remap and segment merge, so
  that an index built before a recorded rewrite publishes keeps the
  mapping it needs once its coverage follows the rewrite.

A deferred compaction (defer_index_remap) on a stable-row-ID table now
records its row-address moves in the fragment reuse index, including on
tables with no indices and for groups no index covers. Release builds
still refuse the option there.

- The planner accepts the option only if every index passes the
  eligibility check, and names each offending index otherwise. It also
  refuses a table whose manifest still requires a tagged fragment reuse
  history, which stable row IDs exclude.
- Recording tasks take the moved rows' old addresses from fragment
  metadata and deletion vectors. They refuse task fragments out of id
  order and a live-row count that disagrees with the rewrite. Row
  lineage is placed for every stable-row-ID task, recording or not.
- The commit records when the option is set or when every task
  recorded, so a commit without options keeps the moves and normalizes
  the source fragments the same way. Mixed tasks,
  or the option with tasks that recorded nothing, are refused before
  any fragment id is reserved, and eligibility is checked again against
  the commit handle.
- When a stable-row-ID rewrite carries a fragment reuse index, address
  indices keep their coverage and readers translate through it. Without
  one they drop the rewritten fragments as before.

Tables without stable row IDs, and stable-row-ID compactions without
the option, behave as before.
brendanclement added a commit to brendanclement/lance that referenced this pull request Sep 30, 2026
…-ID tables

Builds on lance-format#9120 (the eligibility check and the
debug-only gate) and depends on the two commits below it:
- fix: exact FRI watermark for retention, remap and segment merge, so
  that an index built before a recorded rewrite publishes keeps the
  mapping it needs once its coverage follows the rewrite;
- fix: refuse a fragment reuse replacement built from a changed history,
  so that two recording compactions from separate sessions cannot
  discard each other's moves.

A deferred compaction (defer_index_remap) on a stable-row-ID table now
records its row-address moves in the fragment reuse index, including on
tables with no indices and for groups no index covers. Release builds
still refuse the option there.

- The planner accepts the option only if every index passes the
  eligibility check, and names each offending index otherwise. It also
  refuses a table whose manifest still requires a tagged fragment reuse
  history, which stable row IDs exclude.
- Recording tasks take the moved rows' old addresses from fragment
  metadata and deletion vectors. They refuse task fragments out of id
  order and a live-row count that disagrees with the rewrite. Row
  lineage is placed for every stable-row-ID task, recording or not.
- The commit records when the option is set or when every task
  recorded, so a commit without options keeps the moves and normalizes
  the source fragments the same way. Mixed tasks,
  or the option with tasks that recorded nothing, are refused before
  any fragment id is reserved, and eligibility is checked again against
  the commit handle.
- When a stable-row-ID rewrite carries a fragment reuse index, address
  indices keep their coverage and readers translate through it. Without
  one they drop the rewritten fragments as before.

Tables without stable row IDs, and stable-row-ID compactions without
the option, behave as before.
brendanclement added a commit to brendanclement/lance that referenced this pull request Sep 30, 2026
…-ID tables

Builds on lance-format#9120 (the eligibility check and the
debug-only gate) and depends on the two commits below it:
- fix: exact FRI watermark for retention, remap and segment merge, so
  that an index built before a recorded rewrite publishes keeps the
  mapping it needs once its coverage follows the rewrite;
- fix: refuse a fragment reuse replacement built from a changed history,
  so that two recording compactions from separate sessions cannot
  discard each other's moves.

A deferred compaction (defer_index_remap) on a stable-row-ID table now
records its row-address moves in the fragment reuse index, including on
tables with no indices and for groups no index covers. Release builds
still refuse the option there.

- The planner accepts the option only if every index passes the
  eligibility check, and names each offending index otherwise. It also
  refuses a table whose manifest still requires a tagged fragment reuse
  history, which stable row IDs exclude.
- Recording tasks take the moved rows' old addresses from fragment
  metadata and deletion vectors. They refuse task fragments out of id
  order and a live-row count that disagrees with the rewrite. Row
  lineage is placed for every stable-row-ID task, recording or not.
- The commit records when the option is set or when every task
  recorded, so a commit without options keeps the moves and normalizes
  the source fragments the same way. Mixed tasks,
  or the option with tasks that recorded nothing, are refused before
  any fragment id is reserved, and eligibility is checked again against
  the commit handle.
- When a stable-row-ID rewrite carries a fragment reuse index, address
  indices keep their coverage and readers translate through it. Without
  one they drop the rewritten fragments as before.

Tables without stable row IDs, and stable-row-ID compactions without
the option, behave as before.
brendanclement added a commit to brendanclement/lance that referenced this pull request Sep 30, 2026
…-ID tables

Builds on lance-format#9120 (the eligibility check and the
debug-only gate) and depends on the two commits below it:
- fix: exact FRI watermark for retention, remap and segment merge, so
  that an index built before a recorded rewrite publishes keeps the
  mapping it needs once its coverage follows the rewrite;
- fix: refuse a fragment reuse replacement built from a changed history,
  so that two recording compactions from separate sessions cannot
  discard each other's moves.

A deferred compaction (defer_index_remap) on a stable-row-ID table now
records its row-address moves in the fragment reuse index, including on
tables with no indices and for groups no index covers. Release builds
still refuse the option there.

- The planner accepts the option only if every index passes the
  eligibility check, and names each offending index otherwise. It also
  refuses a table whose manifest still requires a tagged fragment reuse
  history, which stable row IDs exclude.
- Recording tasks take the moved rows' old addresses from fragment
  metadata and deletion vectors. They refuse task fragments out of id
  order and a live-row count that disagrees with the rewrite. Row
  lineage is placed for every stable-row-ID task, recording or not.
- The commit records when the option is set or when every task
  recorded, so a commit without options keeps the moves and normalizes
  the source fragments the same way. Mixed tasks,
  or the option with tasks that recorded nothing, are refused before
  any fragment id is reserved, and eligibility is checked again against
  the commit handle.
- When a stable-row-ID rewrite carries a fragment reuse index, address
  indices keep their coverage and readers translate through it. Without
  one they drop the rewritten fragments as before.

Tables without stable row IDs, and stable-row-ID compactions without
the option, behave as before.
westonpace pushed a commit that referenced this pull request Sep 30, 2026
#9120 added a publication-time check for fragment reuse indices on stable
row id datasets that rejects the same row-id-domain index combination.
The duplicate gate fired first with a different error and broke its tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KqTXnUMz52CMzSjmDnutf6
westonpace pushed a commit that referenced this pull request Sep 30, 2026
#9120 already refuses creating a row-id-domain index on a stable row id
dataset that carries a fragment reuse index. The test now matches that
error's wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KqTXnUMz52CMzSjmDnutf6
brendanclement added a commit to brendanclement/lance that referenced this pull request Oct 1, 2026
…-ID tables

Builds on lance-format#9120 (the eligibility check and the
debug-only gate) and depends on the two commits below it:
- fix: exact FRI watermark for retention, remap and segment merge, so
  that an index built before a recorded rewrite publishes keeps the
  mapping it needs once its coverage follows the rewrite;
- fix: refuse a fragment reuse replacement built from a changed history,
  so that two recording compactions from separate sessions cannot
  discard each other's moves.

A deferred compaction (defer_index_remap) on a stable-row-ID table now
records its row-address moves in the fragment reuse index, including on
tables with no indices and for groups no index covers. Release builds
still refuse the option there.

- The planner accepts the option only if every index passes the
  eligibility check, and names each offending index otherwise. It also
  refuses a table whose manifest still requires a tagged fragment reuse
  history, which stable row IDs exclude.
- Recording tasks take the moved rows' old addresses from fragment
  metadata and deletion vectors. They refuse task fragments out of id
  order and a live-row count that disagrees with the rewrite. Row
  lineage is placed for every stable-row-ID task, recording or not.
- The commit records when the option is set or when every task
  recorded, so a commit without options keeps the moves and normalizes
  the source fragments the same way. Mixed tasks,
  or the option with tasks that recorded nothing, are refused before
  any fragment id is reserved, and eligibility is checked again against
  the commit handle.
- When a stable-row-ID rewrite carries a fragment reuse index, address
  indices keep their coverage and readers translate through it. Without
  one they drop the rewritten fragments as before.

Tables without stable row IDs, and stable-row-ID compactions without
the option, behave as before.
westonpace added a commit that referenced this pull request Oct 5, 2026
Enables `defer_index_remap` compaction on stable-row-ID datasets.
Compaction captures pre-rewrite addresses and writes a fragment reuse
index, and address-domain indexes (ZoneMap, BloomFilter) follow their
data instead of losing coverage. Compaction refuses to defer while a
row-id-domain index is present; the compatibility rules from #9120 cover
index creation and publishing.

---

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-docs Documentation A-format On-disk format: protos and format spec docs A-index Vector index, linalg, tokenizer A-python Python bindings enhancement New feature or request format-change A change to the format spec, which requires a vote. Remove if minor (e.g. fixing typo). format-waived Author attests no format vote is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants