forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: don't use leases not acquired by the current process
Before this patch, leases held before a restart could be used after the restart. This is incorrect, since the command queue has been wiped in the restart and so reads and writes are not properly sequenced with possible in-flight commands. Another problem is that a lease that was in the process of being transferred away before the restart is used, and that's no good because it breaks the lease holder's promise to not use that lease. This patch adds a bit of in-memory state to a replica - whether the lease has changed since the process has been started. If it hasn't, a lease is not used _at propose time_ and instead the holder pretends it doesn't have a valid lease and tries to acquire one. Nodes other than the holder do not modify their behavior. No similar check is done at apply time (nor could it) since there we naturally rely on Raft to order writes; so, if the proposer is still the lease holder, there's no reason not to apply a command. fixes cockroachdb#7996
- Loading branch information
1 parent
ca89f45
commit 5287df6
Showing
4 changed files
with
31 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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