Repository navigation
Fix: assert ref snapshot id requirements during snapshot expiration (#4200) - #4265
Open
MsMansiDhruv wants to merge 2 commits into
Open
MsMansiDhruv wants to merge 2 commits into
MsMansiDhruv wants to merge 2 commits into
Conversation
…pache#4200) Signed-off-by: Mansi Dhruv <mansi.p.dhruv@gmail.com>
Signed-off-by: Mansi Dhruv <mansi.p.dhruv@gmail.com>
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 #4200
Rationale for this change
Currently, \ExpireSnapshots._commit\ determines protected snapshots from the table's loaded metadata and sends no table requirements (\self._requirements = ()). When another transaction concurrently moves or rolls back a branch/tag (such as rolling back \main\ to the snapshot being expired), the expiration commit succeeds and \RemoveSnapshotsUpdate\ silently deletes that ref. In the case of \main, the table completely loses its \main\ branch and reads as empty.
This change adds \AssertRefSnapshotId\ requirements to \self._requirements\ for each ref protecting snapshots. If a protected ref has changed concurrently, catalog validation fails with \CommitFailedException\ instead of removing the ref or leaving the table in an inconsistent state.
Are these changes tested?
Yes, tested via unit and integration tests in \ ests/table/test_expire_snapshots.py:
Are there any user-facing changes?
No breaking API changes. Concurrent snapshot expiration safely raises \CommitFailedException\ if a protected branch or tag changed during the operation.