Skip to content

Skip already-deleted manifests and manifest lists in purge_table - #4630

Open
faisal37990 wants to merge 1 commit into
apache:mainfrom
faisal37990:fix/purge-table-skip-missing-manifests
Open

faisal37990 wants to merge 1 commit into
apache:mainfrom
faisal37990:fix/purge-table-skip-missing-manifests

Conversation

@faisal37990

Copy link
Copy Markdown

Summary

Closes #4625.

When purging a table whose manifest lists or manifest files were already removed eagerly by the catalog or storage layer, purge_table previously raised FileNotFoundError in snapshot.manifests() or delete_data_files() before deleting the remaining table files.

Changes

  • MetastoreCatalog.purge_table (pyiceberg/catalog/init.py): Catch FileNotFoundError when reading snapshot.manifests(io, encryption_manager), log at DEBUG level, skip adding the already-missing manifest list to manifest_lists_to_delete, and continue collecting remaining snapshots.
  • delete_data_files (pyiceberg/catalog/init.py): Catch FileNotFoundError when reading manifest_file.fetch_manifest_entry(io, discard_deleted=False), log at DEBUG level, and continue deleting data files referenced by remaining manifests.
  • All other exceptions (e.g., PermissionError, ValueError) continue to propagate unchanged.

Verification

  • Added 4 unit tests in TestPurgeTableMissingManifests (tests/catalog/test_base.py) verifying FileNotFoundError skipping + debug logging and propagation of non-FileNotFoundError errors for both manifest lists and manifests.
  • Ran pytest --noconftest tests/catalog/test_base.py -v (12 passed), ruff check, and ruff format --check (all clean).

faisal37990 added a commit to faisal37990/faisal37990 that referenced this pull request Dec 6, 2026
faisal37990 added a commit to faisal37990/faisal37990.github.io that referenced this pull request Dec 6, 2026
faisal37990 added a commit to faisal37990/faisal37990 that referenced this pull request Dec 6, 2026

@Fokko Fokko 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.

Nice fix @faisal37990, this aligns purge_table with the documented contract that only failures to delete are logged, not raised 🚀 Related: #4617 (same pattern for old metadata files).

faisal37990 added a commit to faisal37990/faisal37990 that referenced this pull request Dec 6, 2026
faisal37990 added a commit to faisal37990/faisal37990.github.io that referenced this pull request Dec 6, 2026

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.

purge_table raises if a manifest or manifest list was already removed by the catalog

2 participants