sikadisamadeisi opened a new pull request, #4543: URL: https://github.com/apache/iceberg-python/pull/4543
Closes #4534 # Rationale for this change When a catalog reports `CommitFailedException` for a commit that actually landed, `Transaction._attempt_landed()` checks whether any snapshot ID added by the attempt is present in the refreshed table metadata. If another writer commits on top and expires all of the attempt's snapshots before `_attempt_landed()` runs, none of those snapshot IDs remain in `metadata.snapshots`, causing the transaction either to delete manifests that the newer snapshot still references (when no retries remain) or to commit the data a second time and delete the earlier manifest (when retries remain), breaking subsequent scans with `FileNotFoundError`. Each commit attempt writes its new manifests under a fresh `commit_uuid`, so no snapshot predating the attempt can reference them, and another writer's snapshot can reference them only if the attempt landed. When snapshot ID lookup misses, `_attempt_landed()` now checks snapshots added since before the refresh for any manifest path in `_written_manifests`. If reading one of those manifest lists fails and no match is found elsewhere, `CommitStateUnknownException` is raised so potentially live files are not deleted. ## Are these changes tested? Yes. Added tests in `tests/table/test_commit_retry.py` covering: - A lost commit response where another writer appends on top and expires all added snapshots (`commit.retry.num-retries=0`), verifying the landed commit and its manifests are preserved. - The same interleaving with retries left (`commit.retry.num-retries=1`), verifying the commit is not applied twice and scans succeed. - An initial conflict followed by a landed retry whose snapshot is expired, verifying uncommitted manifests from the failed attempt are cleaned up while the landed attempt's manifest is kept. - Unreadable manifest lists on newly added snapshots raising `CommitStateUnknownException` without deleting written manifests. ## Are there any user-facing changes? Bug fix only; no public API changes. -- 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]
