Skip to content

fix: keep stable row IDs when cloning or branching an emptied table - #9768

Merged
westonpace merged 2 commits into
lance-format:mainfrom
brendanclement:brendan/keep-stable-row-ids-on-empty-clone
Oct 12, 2026
Merged

westonpace merged 2 commits into
lance-format:mainfrom
brendanclement:brendan/keep-stable-row-ids-on-empty-clone

Conversation

@brendanclement

@brendanclement brendanclement commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

A shallow clone or branch of a stable-row-ID table whose rows had all been deleted lost stable row IDs.

Manifest::shallow_clone keeps only the covering-index and sticky feature flags from the source, and the commit re-derives the rest when it writes the copy's manifest. It derives the stable-row-ID flag from the fragments' row-ID metadata, but an emptied table has no fragments left, so nothing restored the flag. The copy still carried next_row_id, yet rows appended to it got no stable row IDs. A branch is a shallow clone, so it was affected the same way. A deep clone copies the source manifest as is and was not affected.

shallow_clone now also keeps FLAG_STABLE_ROW_IDS, so the copy keeps stable row IDs and continues assigning them from the source's next_row_id. A comment in write_manifest_file that described the old masking is updated.

Without the fix, the shallow-clone and branch cases fail on the reader flag

A shallow clone kept only the covering-index and sticky feature flags of
its source and left the commit to re-derive the rest. The stable-row-ID
flag is derived from the fragments' row-ID metadata, so a copy of a table
whose rows had all been deleted lost it: rows appended to the copy got no
stable row IDs even though it carried the source's next_row_id. Branches
are shallow clones and were affected the same way; deep clones copy the
source manifest as is.

Keep FLAG_STABLE_ROW_IDS in shallow_clone's reader and writer flags.
@github-actions github-actions Bot added the bug Something isn't working label Oct 7, 2026
@brendanclement
brendanclement marked this pull request as ready for review October 7, 2026 21:52

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@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 fix preserves stable-row-ID mode and the allocation counter when an emptied table is shallow-cloned or branched. The persisted reopen-and-append regression covers the failure across all three copy modes; no merge-blocking issue found.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 7, 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.

Nice catch

@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Oct 12, 2026
@westonpace
westonpace merged commit 36f4db6 into lance-format:main Oct 12, 2026
brendanclement added a commit to brendanclement/lance that referenced this pull request Oct 13, 2026
… only)

Two textual conflicts. rust/lance-table/src/format/manifest.rs: the
clone flag mask takes main's split STICKY_READER_FLAGS /
STICKY_WRITER_FLAGS with lance-format#9768's FLAG_STABLE_ROW_IDS, the form lance-format#9768
landed in on main. rust/lance/src/dataset/optimize.rs:
records_stable_row_id_moves keeps lance-format#9611's reworded doc comment with this
branch's added sentence.

lance-format#9611 replaced the _frag_reuse_with_stable_row_ids_enabled binding with
the srid_recording_enabled fixture, which finds the gate by compacting.
This branch's three recording tests take the fixture, and the CI job
that runs them with recording on proves it the same way before running
them, since they also pass on the refusal.
brendanclement added a commit to brendanclement/lance that referenced this pull request Oct 13, 2026
No conflicts. Brings in lance-format#9768 as it landed on main, which this branch
carried at its earlier head fe811c7.
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.

2 participants