-
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.
- Loading branch information
1 parent
29e8b72
commit 14fd9a0
Showing
2 changed files
with
145 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
### Changed: | ||
|
||
- Changed: [342d0de2](https://github.com/datafuselabs/openraft/commit/342d0de2b885388dfa5de64430384bd3275d3697) rename variants in ChangeMembers, add `AddVoters`; by 张炎泼; 2023-03-01 | ||
|
||
Rename `ChangeMembers::AddVoter` to `AddVoterIds`, because it just | ||
updates voter ids. | ||
|
||
Rename `ChangeMembers::RemoveVoter` to `RemoveVoters`. | ||
|
||
Add `ChangeMembers::AddVoters(BTreeMap)` to add voters with | ||
corresponding `Node`, i.e., it adds nodes as learners and update | ||
the voter-ids in a `Membership`. | ||
|
||
### Added: | ||
|
||
- Added: [50821c37](https://github.com/datafuselabs/openraft/commit/50821c37035850dba9e237d9e7474e918f2bd410) impl PartialEq for Entry; by 张炎泼; 2023-03-02 | ||
|
||
### Fixed: | ||
|
||
- Fixed: [97fa1581](https://github.com/datafuselabs/openraft/commit/97fa15815a7d51c35a3a613b11defbf5f49cf4c1) discard blank log heartbeat, revert to the standard heartbeat; by 张炎泼; 2023-03-04 | ||
|
||
- https://github.com/datafuselabs/openraft/issues/698 | ||
|
||
The blank log heartbeat design has two problems: | ||
|
||
- The heartbeat that sends a blank log introduces additional I/O, as a follower has to persist every log to maintain correctness. | ||
|
||
- Although `(term, log_index)` serves as a pseudo time in Raft, measuring whether a node has caught up with the leader and is capable of becoming a new leader, leadership is not solely determined by this pseudo time. | ||
Wall clock time is also taken into account. | ||
|
||
There may be a case where the pseudo time is not upto date but the clock time is, and the node should not become the leader. | ||
For example, in a cluster of three nodes, if the leader (node-1) is busy sending a snapshot to node-2(it has not yet replicated the latest logs to a quorum, but node-2 received message from the leader(node-1), thus it knew there is an active leader), node-3 should not seize leadership from node-1. | ||
This is why there needs to be two types of time, pseudo time `(term, log_index)` and wall clock time, to protect leadership. | ||
|
||
In the follow graph: | ||
- node-1 is the leader, has 4 log entries, and is sending a snapshot to | ||
node-2, | ||
- node-2 received several chunks of snapshot, and it perceived an active | ||
leader thus extended leader lease. | ||
- node-3 tried to send vote request to node-2, although node-2 do not have | ||
as many logs as node-3, it should still reject node-3's vote request | ||
because the leader lease has not yet expired. | ||
|
||
In the obsolete design, extending pseudo time `(term, index)` with a | ||
`tick`, in this case node-3 will seize the leadership from node-2. | ||
|
||
```text | ||
Ni: Node i | ||
Ei: log entry i | ||
N1 E1 E2 E3 E4 | ||
| | ||
v | ||
N2 snapshot | ||
+-----------------+ | ||
^ | | ||
| leader lease | ||
| | ||
N3 E1 E2 E3 | vote-request | ||
---------------+----------------------------> clock time | ||
now | ||
``` | ||
|
||
The original document is presented below for reference. | ||
|
||
- Fixed: [b5caa44d](https://github.com/datafuselabs/openraft/commit/b5caa44d1aac0b539180c1c490f0883dcc83048a) Wait::members() should not count learners as members; by 张炎泼; 2023-03-04 | ||
|
||
`Wait::members()` waits until membership becomes the expected value. | ||
It should not check against all nodes. | ||
Instead, it should only check voters, excluding learners. |