fix(dataset): track fragment add-columns cleanup - #8402
fix(dataset): track fragment add-columns cleanup#8402lance-gatefixer[bot] wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The change closes the fragment-level cleanup ownership gap at the correct boundary: callers can retain a single-use explicit token through the outer merge, while existing Rust and Python return shapes stay compatible and ambiguous commit outcomes never trigger automatic deletion. Cleanup remains scoped to the staged (base_id, path) set, and the stale-merge regression verifies preservation of original, concurrent, and external data.
# Conflicts: # rust/lance/src/dataset/fragment.rs
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The merge from main preserves the explicit staged-file cleanup ownership and correctly integrates the new nullability-conflict metadata. Fragment-level outer merges remain conservatively safe when that optimization signal is unavailable, while the existing Rust and Python return shapes and cleanup behavior remain unchanged.
Summary
Root cause
FileFragment::add_columns discarded the fragments_to_cleanup metadata returned by schema evolution. Fragment-level callers therefore had no safe way to distinguish files staged by their operation from pre-existing or independently committed files after a later Merge failed.
Fix
The new cleanup-aware API returns the staged fragment, schema, and an explicit cleanup token. Cleanup is opt-in and never runs on drop because a failed commit response can be ambiguous. The existing Rust and Python APIs retain their prior return values unless callers explicitly request cleanup ownership.
Validation
Fixes #7231