-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change: use
Vote
to define Leader and Candidate
`Vote` is a similar concept to paxos proposer-id. It is defined by a tuple of `(term, uncommitted|committed, node_id)`. A Candidate creates an uncommitted `Vote` to identify it, as a replacement of `(term, candidate_id)`. A Leader has a `Vote` that is committed, i.e., the vote is granted by a quorum. The rule for overriding a `Vote` is defined by a **partially ordered** relation: a node is only allowed to grant a greater vote. The partial order relation covers all behavior of the `vote` in raft spec. This way wee make the test very easy to be done. With `Vote`, checking validity of a request is quite simple: just by `self.vote <= rpc.vote`. - Rename: save_hard_state() and read_hard_state() to save_vote() and read_vote(). - Replace `term, node_id` pair with `Vote` in RaftCore and RPC struct-s. - Fix: request handler for append-entries and install-snapshot should save the vote they received.
- Loading branch information
1 parent
9a8b750
commit 58f2491
Showing
32 changed files
with
576 additions
and
439 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
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.