[ovs-discuss] [HELP] Question about Raft

Han Zhou hzhou at ovn.org
Fri Mar 6 18:24:39 UTC 2020


On Fri, Mar 6, 2020 at 1:13 AM txfh2007 via discuss <
ovs-discuss at openvswitch.org> wrote:
>
> 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.

Hi Timo, I happened to fix the problem yesterday and here is the patch:
https://patchwork.ozlabs.org/patch/1250116/. Details of my analysis is in
commit message and a test case is added to cover this scenario.

>     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)

When S1 and S3 choose a new leader, they (one of them, or both) would have
to increase the term, too.

>         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"

If S2 or S3 already becomes leader, their term won't be lower than S2. From
this point on, the below steps shouldn't happen. But instead, it is
possible that when S2 receives append-request from the new leader, it has
the same term, and it updates the leader without switching from candidate
to follower, thus result in the candidate state forever.

>         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 ?
>
> Thanks
> Timo
>
Hi Timo,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20200306/3cf7373e/attachment.html>


More information about the discuss mailing list