From 9474e9dd7757383e0222d88259255a1ae6c90843 Mon Sep 17 00:00:00 2001 From: Priya Bibra Date: Tue, 17 Sep 2024 10:11:23 -0700 Subject: [PATCH 1/3] log when recovery is successful/failed + fix messages Signed-off-by: Priya Bibra --- go/vt/vtorc/logic/topology_recovery.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/go/vt/vtorc/logic/topology_recovery.go b/go/vt/vtorc/logic/topology_recovery.go index 30f4178013d..ebd08b51cd3 100644 --- a/go/vt/vtorc/logic/topology_recovery.go +++ b/go/vt/vtorc/logic/topology_recovery.go @@ -716,21 +716,22 @@ func executeCheckAndRecoverFunction(analysisEntry *inst.ReplicationAnalysis) (er log.Infof("executeCheckAndRecoverFunction: proceeding with %+v recovery on %+v; isRecoverable?: %+v", analysisEntry.Analysis, analysisEntry.AnalyzedInstanceAlias, isActionableRecovery) } - if !isActionableRecovery { - vtopsExec.SendSlackMessage(fmt.Sprintf("No actionable recovery on %s for problem %s.", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis), vtopsSlackChannel, true) - } - recoveryAttempted, topologyRecovery, err := getCheckAndRecoverFunction(checkAndRecoverFunctionCode)(ctx, analysisEntry) if !recoveryAttempted { + log.Infof("No recovery attempted on %s for problem %s. Error: %s", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis, err.Error()) return err } recoveryName := getRecoverFunctionName(checkAndRecoverFunctionCode) recoveriesCounter.Add(recoveryName, 1) if err != nil { - vtopsExec.SendSlackMessage(fmt.Sprintf("Recovery failed on %s for problem %s. Error: %s", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis, err.Error()), vtopsSlackChannel, true) + message := fmt.Sprintf("Recovery failed on %s for problem %s. Error: %s", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis, err.Error()) + log.Info(message) + vtopsExec.SendSlackMessage(message, vtopsSlackChannel, true) recoveriesFailureCounter.Add(recoveryName, 1) } else { - vtopsExec.SendSlackMessage(fmt.Sprintf("Recovery succeeded on %s for problem %s.", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis), vtopsSlackChannel, true) + message := fmt.Sprintf("Recovery succeeded on %s for problem %s.", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis) + log.Info(message) + vtopsExec.SendSlackMessage(message, vtopsSlackChannel, true) recoveriesSuccessfulCounter.Add(recoveryName, 1) } if topologyRecovery == nil { From 2730f79827060f5d88efe51f3d31e699e2507286 Mon Sep 17 00:00:00 2001 From: Priya Bibra Date: Tue, 17 Sep 2024 13:07:39 -0700 Subject: [PATCH 2/3] remove message on no recovery Signed-off-by: Priya Bibra --- go/vt/vtorc/logic/topology_recovery.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/go/vt/vtorc/logic/topology_recovery.go b/go/vt/vtorc/logic/topology_recovery.go index ebd08b51cd3..ee36681876d 100644 --- a/go/vt/vtorc/logic/topology_recovery.go +++ b/go/vt/vtorc/logic/topology_recovery.go @@ -610,8 +610,6 @@ func executeCheckAndRecoverFunction(analysisEntry *inst.ReplicationAnalysis) (er } } - vtopsExec.SendSlackMessage(fmt.Sprintf("[VTOrc] No recovery available for %s for problem %s.", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis), vtopsSlackChannel, true) - return nil } From ab221bc2821c7ee584db18f6a30e29c7c99e0e17 Mon Sep 17 00:00:00 2001 From: Priya Bibra Date: Tue, 17 Sep 2024 14:57:59 -0700 Subject: [PATCH 3/3] fix null ptr Signed-off-by: Priya Bibra --- go/vt/vtorc/logic/topology_recovery.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtorc/logic/topology_recovery.go b/go/vt/vtorc/logic/topology_recovery.go index ee36681876d..6b45721540e 100644 --- a/go/vt/vtorc/logic/topology_recovery.go +++ b/go/vt/vtorc/logic/topology_recovery.go @@ -716,7 +716,7 @@ func executeCheckAndRecoverFunction(analysisEntry *inst.ReplicationAnalysis) (er recoveryAttempted, topologyRecovery, err := getCheckAndRecoverFunction(checkAndRecoverFunctionCode)(ctx, analysisEntry) if !recoveryAttempted { - log.Infof("No recovery attempted on %s for problem %s. Error: %s", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis, err.Error()) + log.Infof("No recovery attempted on %s for problem %s.", analysisEntry.AnalyzedInstanceHostname, analysisEntry.Analysis) return err } recoveryName := getRecoverFunctionName(checkAndRecoverFunctionCode)