Repository navigation
fix: preserve projected files across rebased writes - #9219
Merged
Merged
Conversation
# Conflicts: # rust/lance-table/src/transaction/manifest_build.rs
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
With #9218 now in the base, this revision cleanly supplies the remaining Update half: it applies Project’s live-field rule to both staged updated fragments and new fragments, preserving mixed files while preventing fully projected-out files from returning. The strengthened Delete regression confirms the two fixes compose.
Xuanwo
approved these changes
Sep 30, 2026
Xuanwo
pushed a commit
that referenced
this pull request
Sep 30, 2026
## Problem and context An update can fail when a fragment stores its row lineage in data-file columns: ```text cannot commit fragment ...: it marks row lineage field -3 as spilled but none of its data files carries it ``` Row lineage records each row's stable ID, creation version, and last-update version. To keep large per-row sequences out of the manifest, Lance's opt-in spilled-lineage feature can store them as hidden columns in a fragment's data files. Their reserved field IDs (`-3`, `-4`, and `-5`) are absent from the user schema. A fragment's metadata marks which sequences use this storage, and its file list must retain the files carrying those columns. The regression comes from the interaction between two changes: - #9339 added spilling for updates and preserved lineage files across schema changes in the Project and DataReplacement paths. - Later, #9219 added file pruning to the Update manifest path. This pruning is necessary when an update was prepared before a concurrent Project removed a user column: committing the older update must not restore files containing only removed columns. It filters both updated fragments and newly written fragments against the current user schema. The new Update pruning checked only user-schema field IDs. Consequently, it also discarded files containing only hidden lineage columns. This check runs during Update manifest construction even without a concurrent schema change, so an ordinary update can trigger the failure. For example, a fragment can have these files: ```text fragment |-- data.lance [live user field 0] |-- old-column.lance [removed user field 1] `-- lineage.lance [hidden row ID field -3] ``` Pruning should remove `old-column.lance` and retain the other two. Before this fix it also removed `lineage.lance` from the fragment's file list, while the metadata still said row IDs were stored in a column. Commit-time validation then rejected the inconsistent manifest. The observed failure is a rejected commit; this pruning does not physically delete the file. This reproduced in five existing spill tests and caused the Rust CI failures on Linux x86_64, Linux ARM, Windows, and macOS observed on #9034. The failure is in shared Update manifest construction and does not depend on that PR's ignored-index option. ## Fix In both Update pruning locations, retain a file when it contains either a live user field or a spilled lineage field required by that fragment's metadata. This follows the existing Project rule, preserves all three lineage kinds, and continues to remove files containing only projected-out user fields. Carrier validation remains in place. No public API or file format changes are needed. Extend the existing Update manifest regression across the unspecified update mode, RewriteRows, and RewriteColumns, each with and without spilled lineage (six cases). The v2 fixtures use separate files for row IDs, creation versions, and last-update versions, and assert the exact retained file lists for both updated and new fragments. The second changed file only completes the restore/config conflict test's `TransactionRebase` initializer. Its six missing fields otherwise prevent Rust test targets from compiling on the base revision; this is a separate test-build fix. ## Validation - Before the fix: the spill suite had 31 passes and 5 failures with the missing-carrier error. - `cargo test -p lance-table --locked`: 580 unit tests and 3 doc tests passed. - `cargo test -p lance --lib --locked`: 4488 passed, 0 failed, 3 existing ignored tests; all five previously failing spill cases passed. - The six Update manifest regression cases passed again after the test-only clippy cleanup. - `cargo fmt --all` and `cargo clippy --all --tests --benches -- -D warnings` passed.
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.
Summary
Root cause
Delete and Update manifest application reused fragment post-images staged against the transaction read version. When a concurrent Project pruned files whose fields were all removed, those stale post-images could restore the files during rebase. RewriteColumns could also restore a newly written file for a column the Project had removed.
Delete now carries only its deletion-file delta onto the current fragment. The same rule covers a Project with preserves_nullability set to false; both Update rewrite modes are rejected earlier by the nullability conflict pre-check. Update filters both updated and new fragment files against the live projected schema while retaining mixed files that still contain a live field.
Validation
Fixes #9217