Skip to content

Commit

Permalink
fix external repl switchover, add mysql-db ignore in external repl
Browse files Browse the repository at this point in the history
  • Loading branch information
suetin committed Jul 31, 2023
1 parent 2cd7aba commit 6969c45
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ func (app *App) externalCAFileChecker(ctx context.Context) {
localNode := app.cluster.Local()
replicaStatus, err := localNode.GetExternalReplicaStatus()
if err != nil {
app.logger.Errorf("external CA file checker: host %s failed to get external replica status %v", localNode.Host(), err)
if !mysql.IsErrorChannelDoesNotExists(err) {
app.logger.Errorf("external CA file checker: host %s failed to get external replica status %v", localNode.Host(), err)
}
continue
}
if replicaStatus == nil {
Expand Down Expand Up @@ -1211,6 +1213,15 @@ func (app *App) performSwitchover(clusterState map[string]*NodeState, activeNode
}

app.logger.Info("switchover: phase 1: stop replication")

oldMasterNode := app.cluster.Get(oldMaster)
if clusterState[oldMaster].PingOk {
err := oldMasterNode.StopExternalReplication()
if err != nil {
return fmt.Errorf("got error: %s while stopping external replication on old master: %s", err, oldMaster)
}
}

errs2 := util.RunParallel(func(host string) error {
if !clusterState[host].PingOk {
return fmt.Errorf("switchover: failed to ping host %s", host)
Expand All @@ -1225,12 +1236,6 @@ func (app *App) performSwitchover(clusterState map[string]*NodeState, activeNode
return nil
}, activeNodes)

oldMasterNode := app.cluster.Get(oldMaster)
err := oldMasterNode.StopExternalReplication()
if err != nil {
return fmt.Errorf("got error: %s while stopping external replication on old master: %s", err, oldMaster)
}

// count successfully stopped active nodes and check one more time that we have a quorum
var frozenActiveNodes []string
for _, host := range activeNodes {
Expand Down

0 comments on commit 6969c45

Please sign in to comment.