From 65d11dd902574a24d6c96bb0778bd9e9136f5339 Mon Sep 17 00:00:00 2001 From: munakoiso Date: Wed, 9 Oct 2024 09:49:11 +0500 Subject: [PATCH] better logging in switchover --- internal/app/app.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index c6c3d639..11bba651 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -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