Make emergency leadership only available in a cluster with two nodes

This commit is contained in:
Ingo Oppermann
2023-06-30 16:59:11 +02:00
parent c3b604cda2
commit c4d9d8afcb
2 changed files with 11 additions and 4 deletions

View File

@@ -1697,6 +1697,11 @@ func (c *cluster) sentinel() {
"num_peers": stats.NumPeers,
}).Log("Stats")
if stats.NumPeers > 1 {
// Enable emergency leadership only in a configuration with two nodes.
break
}
if stats.LastContact > c.emergencyLeaderTimeout && !isEmergencyLeader {
c.logger.Warn().Log("Force leadership due to lost contact to leader")
c.raftEmergencyNotifyCh <- true