diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2021-02-17 17:21:23 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2021-02-20 10:09:36 +0300 |
commit | 320b84f8773272a378e4c807e85b3a1f5f8bd71a (patch) | |
tree | e7e9c56c53a189aac627bed809453dd3d4b1f442 | |
parent | 736c7f6637ce19e30a3197dbd6f0f5d1b479b588 (diff) |
Print failure errors in case reconciliation failed for repo
Reconciliation does as much as it can and reports back any errors
happened during the execution of the operation. We now show
those messages to the user with FAILURE prefix and a path
to the repository.
Closes: https://gitlab.com/gitlab-org/gitaly/-/issues/3032
-rw-r--r-- | changelogs/unreleased/ps-consistencycheck-at-most.yml | 5 | ||||
-rw-r--r-- | cmd/praefect/subcmd_reconcile.go | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/changelogs/unreleased/ps-consistencycheck-at-most.yml b/changelogs/unreleased/ps-consistencycheck-at-most.yml new file mode 100644 index 000000000..c2f2ff17c --- /dev/null +++ b/changelogs/unreleased/ps-consistencycheck-at-most.yml @@ -0,0 +1,5 @@ +--- +title: Reconciliation sub-command performs as much as possible +merge_request: 3142 +author: +type: changed diff --git a/cmd/praefect/subcmd_reconcile.go b/cmd/praefect/subcmd_reconcile.go index d9431fe41..1f9a62435 100644 --- a/cmd/praefect/subcmd_reconcile.go +++ b/cmd/praefect/subcmd_reconcile.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "context" "errors" "flag" @@ -163,6 +164,17 @@ func (nr nodeReconciler) consumeStream(stream gitalypb.PraefectInfoService_Consi log.Print("Reference storage being used: " + rStorage) } + if len(resp.Errors) > 0 { + var composedErrMsg bytes.Buffer + for _, errMsg := range resp.Errors { + composedErrMsg.WriteString("\t") + composedErrMsg.WriteString(errMsg) + composedErrMsg.WriteString("\n") + } + log.Printf("FAILURE: Internal error(s) occurred for the repo %s: %s", resp.GetRepoRelativePath(), composedErrMsg.String()) + continue + } + if resp.GetReferenceChecksum() == resp.GetTargetChecksum() { log.Print("CONSISTENT: " + resp.GetRepoRelativePath()) continue |