diff mbox series

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

Message ID 1583480926-99714-2-git-send-email-hzhou@ovn.org
State Accepted
Commit cdae6100f89d04c5c29dc86a490b936a204622b7
Headers show
Series None | expand

Commit Message

Han Zhou March 6, 2020, 7:48 a.m. UTC
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@ovn.org>
---
 ovsdb/raft.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff March 6, 2020, 10:38 p.m. UTC | #1
On Thu, Mar 05, 2020 at 11:48:46PM -0800, Han Zhou wrote:
> 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@ovn.org>

Thanks for the patches.  I applied them to master.
Han Zhou March 6, 2020, 10:48 p.m. UTC | #2
On Fri, Mar 6, 2020 at 2:39 PM Ben Pfaff <blp@ovn.org> wrote:
>
> On Thu, Mar 05, 2020 at 11:48:46PM -0800, Han Zhou wrote:
> > 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@ovn.org>
>
> Thanks for the patches.  I applied them to master.

Thanks Ben! Could you help backport these to branch-2.12 and 2.13?
Ben Pfaff March 6, 2020, 11:02 p.m. UTC | #3
On Fri, Mar 06, 2020 at 02:48:39PM -0800, Han Zhou wrote:
> On Fri, Mar 6, 2020 at 2:39 PM Ben Pfaff <blp@ovn.org> wrote:
> >
> > On Thu, Mar 05, 2020 at 11:48:46PM -0800, Han Zhou wrote:
> > > 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@ovn.org>
> >
> > Thanks for the patches.  I applied them to master.
> 
> Thanks Ben! Could you help backport these to branch-2.12 and 2.13?

Done.
diff mbox series

Patch

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. */