Skip to content

Commit

Permalink
move IsMasterDown logic to Cluster run loop
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeinated92 committed Jan 3, 2025
1 parent 68794c2 commit 23bfad2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ func (cluster *Cluster) Run() {
}

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

Expand Down
2 changes: 0 additions & 2 deletions cluster/cluster_topo.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ func (cluster *Cluster) AllServersFailed() bool {
func (cluster *Cluster) TopologyClusterDown() bool {
// search for all cluster down
if cluster.GetMaster() == nil || cluster.GetMaster().State == stateFailed {
cluster.IsMasterDown = true
allslavefailed := true
for _, s := range cluster.slaves {
if s.State != stateFailed && s.State != stateErrorAuth && !s.IsIgnored() {
Expand Down Expand Up @@ -544,7 +543,6 @@ func (cluster *Cluster) TopologyClusterDown() bool {

}
cluster.IsDown = false
cluster.IsMasterDown = false
return false
}

Expand Down

0 comments on commit 23bfad2

Please sign in to comment.