[ovs-discuss] [HELP] Question about Raft
txfh2007 at aliyun.com
Fri Mar 6 09:13:15 UTC 2020
Hi Han && all:
I have a question about RAFT: I have tried the latest OVN-2.30, and have found in some condition, there is one node whose role is always "Candidate" (got by cluster/status cmd), but act as a Follower. My cluster still works well, but it seems odd that a server's role is always Candidate. As far as I know, server's role is normally Follower or Leader.
After digging into related code, I think I can try to describe how to reproduce this scenario:
1. It is three servers cluster: One Leader(S2), Two followers(S1,S3)
2. Try to disconnect Leader(S2) from other two servers,so S2 would add term and send vote request, and meanwhile S1 and S3 would choose a new Leader(Let's say it's S3)
3. Recover connection between S2 and other two nodes, then if S2 receives append entry req from S3, as S3's term is lower, so S2 will reply "stale term"
4. After S3 gets S2's reply, S3 will change its term to S2's value and change its role to follower and then candidate(at the same time , S1/S2/S3 are all candidate role)
5.Then if S2 got S3's vote request and vote for S3, S3 will become new leader, but S2's role is still candidate
I guess The reason is term of S3's vote request is equal to S2's term, For S2, it will change to follower only if receiving vote request whose term value is larger than it own .
Am I right? and the candidate role(but actually is a follower) is reasonable ?
More information about the discuss