Skip to content

Drop deleted-only manifests when overwriting files - #4167

Open
max-parke-scale wants to merge 1 commit into
apache:mainfrom
max-parke-scale:fix-overwrite-deleted-only-manifests
Open

max-parke-scale wants to merge 1 commit into
apache:mainfrom
max-parke-scale:fix-overwrite-deleted-only-manifests

Conversation

@max-parke-scale

Copy link
Copy Markdown

Closes #4165

Rationale for this change

_OverwriteFiles._existing_manifests keeps every parent manifest that has no live files. It reads each manifest with discard_deleted=True, so a manifest whose entries are all DELETED comes back empty and takes the "nothing to delete" branch. Each overwrite also writes a manifest for its own deletions, so with explicit delete_data_file overwrites the manifest list grows by one per commit and every later commit and scan opens all of them. In one production table this reached 388 manifests, 387 of them deleted-only.

This skips parent manifests with no added or existing files before reading them, the rule Java applies in MergingSnapshotProducer.apply. Earlier snapshots keep their own manifest lists, so time travel is unaffected, and each new snapshot still lists the manifest recording its own deletions.

Are these changes tested?

Yes. test_overwrite_drops_manifests_without_live_files runs three overwrites and checks that each snapshot lists two manifests and that the first snapshot still reads its own row; on main the counts are [2, 3, 4]. The unit suite and prek pass.

Are there any user-facing changes?

No API change. Tables written with explicit-delete overwrites stop accumulating deleted-only manifests, and existing tables shed them on their next overwrite.

🧑‍💻🤖 — posted via Claude Code

_OverwriteFiles._existing_manifests kept every parent manifest with no
live files: reading one with discard_deleted=True returns no entries, so
it took the "nothing to delete" branch. Each explicit-delete overwrite
therefore added a manifest that every later commit and scan opened.
Skip parent manifests with no added or existing files, as Java's
MergingSnapshotProducer does.

Closes apache#4165

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Overwrite keeps deleted-only manifests, so the manifest list grows by one on every overwrite

1 participant