How to join candidate which term is larger than leader's term

61 views
Skip to first unread message

Thông Phạm Văn

unread,
Dec 7, 2017, 4:05:24 AM12/7/17
to raft-dev
Assume that, we have 5 candidate severs including S1(term 3), S2(term 3), S3(term 3), S4 (term 4) and S5(term 5). If S4 got the majority vote and become to leader at term 4, the cluster will has a leader(S4), 3 follower(S1, S2, S3) and 1 candidate(S5). Then, leader S4 will send heartbeat to S1, S2, S3, S5. However, S5 will reject the heartbeat request because it's term is larger than 4. S5 will be always at candidate state. How to join S5 to cluster.

Many thanks.  

David B Murray

unread,
Dec 8, 2017, 12:25:30 PM12/8/17
to raft...@googlegroups.com
The rules for servers include:

- If RPC request or response contains term T > currentTerm: set currentTerm = T, convert to follower (§5.1)

When S5 rejects S4's heartbeat, the response with term=5 will cause S4 to become a follower with term = 5. Assuming that all of S5's RequestVote RPCs for term 5 got lost so it never collects any votes, the election for term 5 will time out and someone will eventually start an election for term 6.

-d

On Thu, Dec 7, 2017 at 1:05 AM, Thông Phạm Văn <thon...@gmail.com> wrote:
Assume that, we have 5 candidate severs including S1(term 3), S2(term 3), S3(term 3), S4 (term 4) and S5(term 5). If S4 got the majority vote and become to leader at term 4, the cluster will has a leader(S4), 3 follower(S1, S2, S3) and 1 candidate(S5). Then, leader S4 will send heartbeat to S1, S2, S3, S5. However, S5 will reject the heartbeat request because it's term is larger than 4. S5 will be always at candidate state. How to join S5 to cluster.

Many thanks.  

--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Thông Phạm Văn

unread,
Dec 10, 2017, 9:26:14 PM12/10/17
to raft-dev
Is this sentence in the paper:
If a candidate or leader discovers that its term is out of date, it immediately reverts to follower state.

Can you explain more details on this phrase "discovers that its term is out of date", how many case can this happen?

Vào 00:25:30 UTC+7 Thứ Bảy, ngày 09 tháng 12 năm 2017, David Murray đã viết:

jordan.h...@gmail.com

unread,
Dec 11, 2017, 2:46:19 AM12/11/17
to raft...@googlegroups.com
A node discovers its term is out of date by RequestVote requests/responses, AppendEntries requests/responses, etc. Any node that receives a term greater than its own term always updates its term and transitions back to follower of necessary. Virtually all communication could result in a node discovering its term is out of date.
--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.

Thông Phạm Văn

unread,
Dec 11, 2017, 3:27:17 AM12/11/17
to raft-dev
I think that a node become a follower when it know which node is exactly a leader, am I correct? Sorry if it is beginner question. 

Vào 14:46:19 UTC+7 Thứ Hai, ngày 11 tháng 12 năm 2017, Jordan Halterman (kuujo) đã viết:

David B Murray

unread,
Dec 13, 2017, 11:54:45 AM12/13/17
to raft...@googlegroups.com
All of us who are not beginners got there by asking beginner questions. :)

A follower does not necessarily know who the leader is, or even if there is one. What distinguishes a follower is that it is not trying to become the leader, at least for the current term. Either because:

- It has received an AppendEntries from the leader (and therefore knows who the leader is)

- It has received a RequestVote from a candidate who it has given its vote to, but does not yet know if that candidate has won the election

- It used to be the leader in a previous term but has received an error reply from another node indicating that its term has ended and a new term has started (which may or may not already have a leader)

- It has just rebooted and doesn’t know the current state of the cluster (but chances are there’s already a leader)

-d
Reply all
Reply to author
Forward
0 new messages