faisal37990 opened a new pull request, #4630:
URL: https://github.com/apache/iceberg-python/pull/4630

   ## 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).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to