Skip to content

Commit

Permalink
better logging in switchover
Browse files Browse the repository at this point in the history
  • Loading branch information
munakoiso committed Oct 9, 2024
1 parent 9a266ac commit 65d11dd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1219,13 +1219,17 @@ func (app *App) performSwitchover(clusterState map[string]*NodeState, activeNode

errs2 := util.RunParallel(func(host string) error {
if !clusterState[host].PingOk {
return fmt.Errorf("switchover: failed to ping host %s", host)
errMessage := fmt.Sprintf("switchover: failed to ping host %s", host)
app.logger.Warn(errMessage)
return fmt.Errorf("%s", errMessage)
}
node := app.cluster.Get(host)
// in case node is a replica
err := node.StopSlaveIOThread()
if err != nil || app.emulateError("freeze_stop_slave_io") {
return fmt.Errorf("failed to stop slave on host %s: %s", host, err)
errMessage := fmt.Sprintf("failed to stop slave on host %s: %s", host, err)
app.logger.Warn(errMessage)
return fmt.Errorf("%s", errMessage)
}
app.logger.Infof("switchover: host %s replication IO thread stopped", host)
return nil
Expand Down

0 comments on commit 65d11dd

Please sign in to comment.