Repository navigation
[core] Check the commit lease after the snapshot existence check - #10954
Open
LuciferYang wants to merge 3 commits into
Open
LuciferYang wants to merge 3 commits into
LuciferYang wants to merge 3 commits into
Conversation
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.
Purpose
close #10953
A filesystem-managed commit checks its lease before
RenamingSnapshotCommit.commitImpl, which then asks the file system whether the new snapshot file exists before it publishes. On an object store that request can outlast the lease, and the snapshot was still published. If another writer got the lock in the meantime and committed the same snapshot id, and the store's rename replaces an existing target, its snapshot was overwritten and its commit lost, although it had reported success.commitImplnow checks the lease again after the existence check, beforetryToWriteAtomic. A slow write insidetryToWriteAtomiccan still outlast the lease; this only removes the extra request between the check and the write. The LATEST hint written after a successful publish is unchanged: the snapshot is already committed at that point, and a stale hint is corrected when the latest snapshot is looked up.Tests
RenamingSnapshotCommitTest#testExpiredLeaseDoesNotOverwriteAnotherWritersSnapshot: two writers of one table share a lease lock on a FileIO whose rename replaces the target. Writer A's lease expires while it checks whether snapshot 2 exists, and writer B, which gets the lock then, commits snapshot 2. On master writer A overwrites it and the table loses writer B's row. With the fix writer A fails the check, retries and commits snapshot 3, and the table has all rows. With a rename that does not replace the target, master keeps all rows too.RenamingSnapshotCommitTest#testCommitRechecksLeaseAfterCheckingSnapshot: the lease expires during the existence check, and the commit fails with the lease error without writing the snapshot.It takes both a rename that replaces the target and an existence check that outlasts the lease. The JDBC and Hive locks renew on every check (8 minutes by default for JDBC), the REST lock renews in the background.
API and Format
no
Documentation
no