[ovs-dev] [PATCH 2/2] raft: Unset leader when starting election.

Han Zhou hzhou at ovn.org
Fri Mar 6 07:48:46 UTC 2020


During election, there shouldn't be any leader. This change makes sure
that a server in candidate role always report leader as "unknown".

Signed-off-by: Han Zhou <hzhou at ovn.org>
---
 ovsdb/raft.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index 2e1144c..1717ccc 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -1643,6 +1643,7 @@ raft_start_election(struct raft *raft, bool leadership_transfer)
 
     ovs_assert(raft->role != RAFT_LEADER);
 
+    raft->leader_sid = UUID_ZERO;
     raft->role = RAFT_CANDIDATE;
     /* If there was no leader elected since last election, we know we are
      * retrying now. */
-- 
2.1.0



More information about the dev mailing list