From a88b984b9a9717daea1e27a1f52fe740dbb6a200 Mon Sep 17 00:00:00 2001 From: Keepers Date: Tue, 21 Feb 2023 13:57:30 -0700 Subject: [PATCH] log all recoverable errors in backup/restore (#2598) ## Description fault is aggregating recoverable errors, but no code currently reports them. This is a quick hack to add logging around those errors. In the future, we'll want to refine who and where performs this report. ## Does this PR need a docs update or release note? - [x] :no_entry: No ## Type of change - [x] :broom: Tech Debt/Cleanup ## Issue(s) * #1970 ## Test Plan - [x] :muscle: Manual --- src/internal/operations/backup.go | 9 +++++++++ src/internal/operations/restore.go | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index 6ecf7db85..e597e30da 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -169,6 +169,15 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { opStats.readErr = op.Errors.Err() } + // TODO: the consumer (sdk or cli) should run this, not operations. + recoverableCount := len(op.Errors.Errs()) + for i, err := range op.Errors.Errs() { + logger.Ctx(ctx). + With("error", err). + With(clues.InErr(err).Slice()...). + Errorf("doing backup: recoverable error %d of %d", i+1, recoverableCount) + } + // ----- // Persistence // ----- diff --git a/src/internal/operations/restore.go b/src/internal/operations/restore.go index e9f27869d..63565d852 100644 --- a/src/internal/operations/restore.go +++ b/src/internal/operations/restore.go @@ -156,6 +156,15 @@ func (op *RestoreOperation) Run(ctx context.Context) (restoreDetails *details.De opStats.readErr = op.Errors.Err() } + // TODO: the consumer (sdk or cli) should run this, not operations. + recoverableCount := len(op.Errors.Errs()) + for i, err := range op.Errors.Errs() { + logger.Ctx(ctx). + With("error", err). + With(clues.InErr(err).Slice()...). + Errorf("doing restore: recoverable error %d of %d", i+1, recoverableCount) + } + // ----- // Persistence // -----