Repository navigation
fix: collect unreferenced data newer than retained manifests - #8944
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The latest merge from main leaves the assessed cleanup patch unchanged; the newly merged changes are confined to unrelated format documentation/protobuf and ANN/FTS code. The cleanup candidate logic and its prior focused verification therefore still support this recommendation.
jackylee-ch
added a commit
to jackylee-ch/lance-duckdb
that referenced
this pull request
Oct 17, 2026
With delete_unverified, Lance 13 lists data files without an age cutoff (lance-format/lance#8944), so VACUUM LANCE deleted the data files of writes a transaction had not committed yet, and its COMMIT then published a table that could no longer be read. Refuse delete_unverified while a transaction in this database holds Lance writes waiting for its COMMIT, and document what the option removes, what the check cannot see, and that the refusal aborts the transaction it runs in.
This was referenced Oct 18, 2026
Open
5 tasks done
Xuanwo
added a commit
to lance-format/lance-duckdb
that referenced
this pull request
Oct 26, 2026
* chore: update lance dependency to v13.0.0 Lance 13 drops RowIdMeta::External, so build_row_id_index loads row id sequences through load_row_id_sequence, which also reads row ids spilled to a data-file column. Cleanup is best-effort in Lance 13, so the cleanup metrics now report failed_deletes. * docs(maintenance): document failed_deletes for VACUUM LANCE Lance 13 no longer fails cleanup on a file it cannot delete (lance-format/lance#9414): the file is counted in failed_deletes and left for a later run. List the VACUUM LANCE metrics, note that cleanup is best-effort, and assert failed_deletes on the VACUUM LANCE surface. * fix(write): restate destination extension types on append Lance checks an append against the destination and writes it under the destination's fields; its check ignores most extensions, so Lance 12 recorded the destination's extensions whatever a batch carried. Lance 13's file writers now reject a batch whose extensions differ from those fields (lance-format/lance#9478), which broke INSERT and COPY appends Lance 12 accepted: DuckDB drops extensions it does not model, such as arrow.fixed_shape_tensor, adds its own under arrow_lossless_conversion, such as arrow.opaque on BIT, and spells geoarrow.wkb metadata its own way. Wherever Lance would give both sides the same type, appends now take the destination's extensions, which is what Lance 12 recorded; JSON text takes only the metadata, keeping the arrow.json name that makes Lance convert it. As with Lance 12, the values are not checked against those extensions. Blob v2 fields, which Lance reads by their extension, and the items of fixed-size lists of structs, which its check compares whole, are left to Lance. Writes that create or overwrite a dataset are left as they are. Lance's schema describes the items of a fixed-size list that are not structs by Lance type alone, so Lance 13 rejects a create or overwrite that writes rows of such items with an extension. For UUID, HUGEINT, UHUGEINT, TIME_TZ and BOOLEAN items under arrow_lossless_conversion, Lance 12 wrote the rows without the item type, as both versions still do when a create writes no rows. It did the same for variable-width items with an extension, such as GEOMETRY's, when no item held a value; otherwise its encoder panicked, aborting DuckDB. On appends, the items of a fixed-size list that are not structs take the destination's extension the same way, as if they were fields, so they can lose one such as GEOMETRY's. A COPY appending GEOMETRY[2] rows with a non-null item to a table made by CREATE TABLE ... GEOMETRY[2], for example, then reaches that encoder panic, as it did on Lance 12; Lance 13 without this change rejected those rows. * fix(maintenance): refuse delete_unverified with uncommitted Lance writes With delete_unverified, Lance 13 lists data files without an age cutoff (lance-format/lance#8944), so VACUUM LANCE deleted the data files of writes a transaction had not committed yet, and its COMMIT then published a table that could no longer be read. Refuse delete_unverified while a transaction in this database holds Lance writes waiting for its COMMIT, and document what the option removes, what the check cannot see, and that the refusal aborts the transaction it runs in. --------- Co-authored-by: Xuanwo <[email protected]>
Xuanwo
pushed a commit
that referenced
this pull request
Nov 15, 2026
…dest retained version (#10899) `cleanup_old_versions` listed `_transactions/` and `_deletions/` only up to the commit time of the oldest retained manifest, unless a deleted version was newer than it. A transaction or deletion file that no manifest references and that was written after that version was never listed, so the 7-day rule never removed it, and `delete_unverified` removed it only when a version-only policy let cleanup skip reading expired manifests, which also dropped the cutoff. #8944 fixed the same problem for `data/`, and `_blobs/` has used that cutoff since it was added. These two directories now use the same cutoff as `data/`: the later of the oldest retained manifest's commit time and `now - 7 days`, or no cutoff when a deleted version is newer than the oldest retained one or `delete_unverified` is set. Every listed file still goes through the reference check, so a file that a retained manifest references is kept, and a file that no manifest references is kept while it is younger than 7 days, unless `delete_unverified` is set. Fixes #10898. The 7-day rule in the module docs now reaches every unreferenced file in these two directories. A deletion file written by an uncommitted delete and committed more than 7 days later can now be removed by a cleanup that runs before the commit, as a data file written by an uncommitted append already can. Under `delete_unverified` no listing uses the retained-manifest cutoff any more, so the flag that the `delete_unverified` fast path set to drop that cutoff is removed. The `delete_unverified` docs in Rust and Java now say it applies to files that no manifest references, not only data files, and that it is only safe when no other operation is in progress; the module docs now list unreferenced transaction files. ## Testing `cleanup_deletes_aged_orphan_newer_than_retained_manifests` now also writes unreferenced transaction and deletion files, one set before the oldest retained version and one after every manifest, and commits a delete after the oldest retained version, so that delete's deletion file is newer than the version. The orphans must be removed by age and under `delete_unverified`, and the default policy must keep them while they are younger than 7 days, including the set the cutoff lists. The retained deletion file and the row count stay in every case. Reverting the cutoff of either directory fails the removal cases, and skipping the age check for either kind of file fails the case that keeps them.
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
cleanup_old_versions capped the data subtree listing at the earliest retained manifest timestamp. Abandoned writes are not owned by any manifest and can be newer than that timestamp, so they never reached the existing age and delete_unverified checks.
Validation
Fixes #8942