Skip to content

Commit 23bfad2

Browse files
committed
move IsMasterDown logic to Cluster run loop
1 parent 68794c2 commit 23bfad2

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

cluster/cluster.go

+1
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ func (cluster *Cluster) Run() {
694694
}
695695

696696
cluster.IsFailable = cluster.GetStatus()
697+
cluster.IsMasterDown = cluster.GetMaster() == nil || cluster.GetMaster().IsFailed()
697698
// CheckFailed trigger failover code if passing all false positiv and constraints
698699
cluster.CheckFailed()
699700

cluster/cluster_topo.go

-2
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ func (cluster *Cluster) AllServersFailed() bool {
516516
func (cluster *Cluster) TopologyClusterDown() bool {
517517
// search for all cluster down
518518
if cluster.GetMaster() == nil || cluster.GetMaster().State == stateFailed {
519-
cluster.IsMasterDown = true
520519
allslavefailed := true
521520
for _, s := range cluster.slaves {
522521
if s.State != stateFailed && s.State != stateErrorAuth && !s.IsIgnored() {
@@ -544,7 +543,6 @@ func (cluster *Cluster) TopologyClusterDown() bool {
544543

545544
}
546545
cluster.IsDown = false
547-
cluster.IsMasterDown = false
548546
return false
549547
}
550548

0 commit comments

Comments
 (0)