v0.9.15
Summary:
- Fixed:
- Added:
- 5f5d7e9f Add
TypeConfigExt
to simplifyRaftTypeConfig
Access.
- 5f5d7e9f Add
Detail:
Fixed:
-
Fixed: 0b1293f3 Should not update
vote
when seeing higher vote inRequestVote
response; by 张炎泼; 2024-07-04This commit addresses an issue in the vote updating mechanism during the
handling ofRequestVote
responses. Previously, encountering a higher
vote
in a response incorrectly led to an update of the local
state.vote
, which could break Raft consistency rules.Issue Description:
- A higher
vote
seen in aRequestVote
response does not necessarily
mean that the vote is granted. The localstate.vote
should only be
updated if the vote is actually granted, i.e., the responding node has
a highervote
and alast_log_id
that allows it to become a leader.
Resolution:
- The local
state.vote
will no longer be updated upon merely seeing a
highervote
in theRequestVote
response. Instead, this higher vote
will be recorded inlast_seen_vote
for consideration in the next
election cycle, without updating the currentstate.vote
.
This bug is introduced in: f0a9e34
- A higher
-
Fixed: 94b1e843 Clarify that receiving an equal vote does not grant leadership.; by 张炎泼; 2024-08-28
A node's
vote
may be updated when a leader observes a higher vote.
In such cases, the leader updates its local vote and steps down.
However, this vote update does not imply that the node accepts the
higher vote as valid for leadership, as it has not yet compared their
logs.In this commit, re-enable
VoteResponse.vote_granted
to indicate a vote
is granted.This commit also fix:
- Fix: #1236
Added:
-
Added: 5f5d7e9f Add
TypeConfigExt
to simplifyRaftTypeConfig
Access; by 张炎泼; 2024-07-03This commit introduces a new trait,
TypeConfigExt
, which extends
RaftTypeConfig
. The purpose of this trait is to simplify the access to
various functionalities provided by theRaftTypeConfig
trait,
enhancing code readability and reducing complexity.Methods Added to
TypeConfigExt
:now()
sleep()
sleep_until()
timeout()
timeout_at()
oneshot()
spawn()
Usage Improvement:
- Instead of using the
<<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::Instant::now()
,
you can now simply callC::now()
.