Skip to content

Commit

Permalink
PMM-11178 retry errors during PBM restore check (#1478)
Browse files Browse the repository at this point in the history
* PMM-11178 retry describe restores error

* reset on success

* move else block outside
  • Loading branch information
idoqo authored and artemgavrilov committed Dec 6, 2022
1 parent ff5ef5c commit 1cc0dd2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion agent/runner/jobs/pbm_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func waitForPBMRestore(ctx context.Context, l logrus.FieldLogger, dbURL *url.URL
ticker := time.NewTicker(statusCheckInterval)
defer ticker.Stop()

maxRetryCount := 5
for {
select {
case <-ticker.C:
Expand All @@ -338,8 +339,16 @@ func waitForPBMRestore(ctx context.Context, l logrus.FieldLogger, dbURL *url.URL
err = execPBMCommand(ctx, dbURL, &info, "describe-restore", name)
}
if err != nil {
return errors.Wrap(err, "failed to get restore status")
if maxRetryCount > 0 {
maxRetryCount--
l.Warnf("PMM failed to get backup restore status and will retry: %s", err)
continue
} else {
return errors.Wrap(err, "failed to get restore status")
}
}
// reset maxRetryCount if we were able to successfully get the current restore status
maxRetryCount = 5

switch info.Status {
case "done":
Expand Down

0 comments on commit 1cc0dd2

Please sign in to comment.