-
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.
Epoch-based range leases implementation
Introduce new epoch-based range leases. These are designed to use the same machinery as the expiration-based leases but use epochs from the node liveness table instead of expirations. The same Lease protobuf is utilized for both types of leases, but there's now an optional Epoch. Previously, the lease proto had a "stasis" timestamp that's now removed and replaced by logic in the replica to evaluate the state of a lease. In order to evaluate whether a lease is valid at command apply time (downstream of Raft), we evaluate the lease upstream of Raft and send it with every Raft command to be compared to the lease at apply time. See: https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/range_leases.md Epoch-based leases can be enabled or disabled with the `COCKROACH_ENABLE_EPOCH_LEASES` environment variable. This change fixes a previously possible loophole in lease verification for expiration-based leases. In this scenario, a node could propose a command with an older lease, transfer it away, receive a new lease, and then execute the command.
- Loading branch information
1 parent
1e84ade
commit 31ad27d
Showing
45 changed files
with
1,541 additions
and
947 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Oops, something went wrong.