]> git.proxmox.com Git - mirror_ovs.git/commit
ovsdb raft: Avoid unnecessary reconnecting during leader election.
authorHan Zhou <hzhou8@ebay.com>
Fri, 19 Apr 2019 19:17:47 +0000 (12:17 -0700)
committerBen Pfaff <blp@ovn.org>
Mon, 22 Apr 2019 20:02:59 +0000 (13:02 -0700)
commit4d9b28cbb797ad112d2aefccab93c7d37493941a
tree1a9af65f39ecdde9cb99c236b119868058a83c89
parent9f39622ab2c67b2f1496b9ee9a395c204527f584
ovsdb raft: Avoid unnecessary reconnecting during leader election.

If a server claims itself as "disconnected", all clients connected
to that server will try to reconnect to a new server in the cluster.

However, currently a server would claim itself as disconnected even
when itself is the candidate and try to become the new leader (most
likely it will be), and all its clients will reconnect to another
node.

During a leader fail-over (e.g. due to a leader failure), it is
expected that all clients of the old leader will have to reconnect
to other nodes in the cluster, but it is unnecessary for all the
clients of a healthy node to reconnect, which could cause more
disturbance in a large scale environment.

This patch fixes the problem by slightly change the condition that
a server regards itself as disconnected: if its role is candidate,
it is regarded as disconnected only if the election didn't succeed
at the first attempt. Related failure test cases are also unskipped
and all passed with this patch.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
ovsdb/raft.c
tests/ovsdb-cluster.at