You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raft: ignore setting the lead field from a MsgDeFortify at current term
When receiving a MsgDeFortifyLeader at the same term as we are, we
should not set the lead field to the sender. Mainly for two reasons:
1) By definition, a MsgDeFortifyLeader is sent by an ex-leader until it
hears of a new committed term. If we forgot the leader at the current
term, we shouldn't remember it since we are using the fact that
lead==None to indicate that this replica has been leaderless for
some time. Read the leaderlessWatcher for more details.
2) This could lead to a situation where no replica can win an election
as it could require votes from some replicas that still know who know
the leader is (due to MsgDefortifyLeader), and that have recently
campaigned and lost due to not having the most up-to-date log, which
reset the electionElapsed to 0. Meaning that this replica is in a
heartbeat lease, and will reject MsgVotes.
Fixes: #142994
Release note: None
# Fix the randomized election timeout to be one tick-election.
152
147
set-randomized-election-timeout 1 timeout=3
@@ -170,13 +165,104 @@ stabilize
170
165
INFO 1 has received 1 MsgPreVoteResp votes and 0 vote rejections
171
166
> 2 receiving messages
172
167
1->2 MsgPreVote Term:2 Log:1/12
173
-
INFO 2 [logterm: 1, index: 11, vote: 1] ignored MsgPreVote from 1 [logterm: 1, index: 12] at term 1: recently received communication from leader (remaining ticks: 3)
174
-
175
-
# At this point we saw that both peers attempted to campaign, but non of them
176
-
# succeeded. Peer 1's request got rejected because 2 recently heard from 1
177
-
# when receiving the MsgDefortifyLeader request.
178
-
# Note that now 2 thinks that 1 is the leader for term 1, even though it isn't.
168
+
INFO 2 [logterm: 1, index: 11, vote: 1] cast MsgPreVote for 1 [logterm: 1, index: 12] at term 1
169
+
> 2 handling Ready
170
+
Ready MustSync=false:
171
+
Messages:
172
+
2->1 MsgPreVoteResp Term:2 Log:0/0
173
+
> 1 receiving messages
174
+
2->1 MsgPreVoteResp Term:2 Log:0/0
175
+
INFO 1 received MsgPreVoteResp from 2 at term 1
176
+
INFO 1 has received 2 MsgPreVoteResp votes and 0 vote rejections
177
+
INFO 1 became candidate at term 2
178
+
INFO 1 [logterm: 1, index: 12] sent MsgVote request to 2 at term 2
0 commit comments