From 3cc5d05b6acb33b53e6f83f862fb57b561c03d9a Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Wed, 10 Apr 2019 10:09:36 -0700 Subject: [PATCH] Fix perf standby elections when the new active node was also the previous active node (#6561) --- vault/ha.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vault/ha.go b/vault/ha.go index 47721d90722a..6884b9ef5cd0 100644 --- a/vault/ha.go +++ b/vault/ha.go @@ -646,6 +646,12 @@ func (c *Core) periodicLeaderRefresh(newLeaderCh chan func(), stopCh chan struct lopCount := opCount isLeader, _, newClusterAddr, _ := c.Leader() + // If we are the leader reset the clusterAddr since the next + // failover might go to the node that was previously active. + if isLeader { + clusterAddr = "" + } + if !isLeader && newClusterAddr != clusterAddr && newLeaderCh != nil { select { case newLeaderCh <- nil: