-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: clean up colocation of leaseholder and raft leader
When the Raft leader is not colocated with the leaseholder, we transfer the Raft leadership to the leaseholder, as long as the leaseholder has not fallen behind on applying log entries. There are two important places where we want to perform this check: 1. when we apply a new lease, in case the lease has changed hands; and 2. on every tick, to catch cases where were unable to transfer Raft leadership immediately because the leaseholder had fallen behind. Instead of duplicating this logic in both places, share a helper function. Also hoist the on-tick check out of shouldReplicaQuiesce. Though that function is called on every tick, it was an extremely non-obvious place to be checking for leadership/leaseholder colocation. Release note: None
- Loading branch information
Showing
4 changed files
with
54 additions
and
74 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