Repository navigation
Detect landed commits via written manifests when snapshots were expired - #4543
Open
sikadisamadeisi wants to merge 1 commit into
Open
sikadisamadeisi wants to merge 1 commit into
sikadisamadeisi wants to merge 1 commit into
Conversation
If another writer commits on top of a landed commit whose response was lost and expires all of its snapshots before _attempt_landed() runs, snapshot ID lookup misses it. Check newly added snapshots in the refreshed metadata for the attempt's written manifests so cleanup keeps live manifests and retries do not commit the data a second time.
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 #4534
Rationale for this change
When a catalog reports
CommitFailedExceptionfor 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 inmetadata.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 withFileNotFoundError.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,CommitStateUnknownExceptionis raised so potentially live files are not deleted.Are these changes tested?
Yes. Added tests in
tests/table/test_commit_retry.pycovering:commit.retry.num-retries=0), verifying the landed commit and its manifests are preserved.commit.retry.num-retries=1), verifying the commit is not applied twice and scans succeed.CommitStateUnknownExceptionwithout deleting written manifests.Are there any user-facing changes?
Bug fix only; no public API changes.