Repository navigation
Conversation
With write.metadata.delete-after-commit.enabled, a REST catalog server can remove old metadata files during the commit. The client then tries to delete them again in delete_files and logs 'Failed to delete metadata file' on every commit, even though the file is gone. Treat FileNotFoundError as already deleted and log it at debug level. Other OSErrors, such as permission errors, still produce the warning. Closes apache#4612
This branch has not been deployed
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.
Closes #4612
Rationale for this change
With
write.metadata.delete-after-commit.enabled=true, a REST catalog server can remove old metadata files during the commit. The client then tries to delete those same files indelete_files()and logsFailed to delete metadata file ...on every commit, even though the file is already gone.This change treats
FileNotFoundErrorindelete_files()as "already deleted" and logs it at debug level instead. OtherOSErrors, such as permission errors, still produce the warning. The issue asked whetherdelete_filesshould ignoreFileNotFoundErroror whether the client should skip deletion for REST catalogs. This takes the first option, so SqlCatalog and other catalogs keep cleaning up old metadata as before.Are these changes tested?
Yes.
test_delete_metadata_already_removed_by_server_does_not_warnsetswrite.metadata.previous-versions-max=2, deletes the oldest metadata file before each commit to stand in for the server, and checks that no warning is logged. It fails without the fix and passes with it on the memory and SqlCatalog fixtures.test_delete_files_still_warns_on_other_os_errorschecks that a permission error still logs the warning.tests/catalog/test_catalog_behaviors.pypasses (872 passed), and ruff check and format are clean.Are there any user-facing changes?
Yes. Users of REST catalogs with
write.metadata.delete-after-commit.enabled=trueno longer get a "Failed to delete metadata file" warning on every commit. Purge-table cleanup also no longer warns about files that are already missing.