Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-02-03 19:05:12 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-02-04 15:37:12 +0300
commit9a9ac34fce75a90c3e26485ec49d929ed0390cd4 (patch)
tree684c8e91173663df3a93caecb69f894cfc092c31
parent351494103c7cdfa16d87cfe7e9781254acb98e0a (diff)
hook: Log errors when stopping transactions fails
When we have to stop transactions because some primary-specific logic has failed, then we currently completely ignore any errors which happen when stopping the transaction itself. We can't really help this given that the initial error is the actual root cause and thus the error we want to return. But we can at least improve the code by logging those issues.
-rw-r--r--internal/gitaly/hook/postreceive.go5
-rw-r--r--internal/gitaly/hook/prereceive.go5
-rw-r--r--internal/gitaly/hook/update.go5
3 files changed, 12 insertions, 3 deletions
diff --git a/internal/gitaly/hook/postreceive.go b/internal/gitaly/hook/postreceive.go
index 0372dc625..6ab89ecdd 100644
--- a/internal/gitaly/hook/postreceive.go
+++ b/internal/gitaly/hook/postreceive.go
@@ -133,7 +133,10 @@ func (m *GitLabHookManager) PostReceiveHook(ctx context.Context, repo *gitalypb.
// If the post-receive hook declines the push, then we need to stop any
// secondaries voting on the transaction.
- m.stopTransaction(ctx, payload)
+ if err := m.stopTransaction(ctx, payload); err != nil {
+ ctxlogrus.Extract(ctx).WithError(err).Error("failed stopping transaction in post-receive hook")
+ }
+
return err
}
}
diff --git a/internal/gitaly/hook/prereceive.go b/internal/gitaly/hook/prereceive.go
index 2c3cfb4eb..41dc8aca7 100644
--- a/internal/gitaly/hook/prereceive.go
+++ b/internal/gitaly/hook/prereceive.go
@@ -72,7 +72,10 @@ func (m *GitLabHookManager) PreReceiveHook(ctx context.Context, repo *gitalypb.R
// If the pre-receive hook declines the push, then we need to stop any
// secondaries voting on the transaction.
- m.stopTransaction(ctx, payload)
+ if err := m.stopTransaction(ctx, payload); err != nil {
+ ctxlogrus.Extract(ctx).WithError(err).Error("failed stopping transaction in pre-receive hook")
+ }
+
return err
}
}
diff --git a/internal/gitaly/hook/update.go b/internal/gitaly/hook/update.go
index daa21ecf1..d8910b055 100644
--- a/internal/gitaly/hook/update.go
+++ b/internal/gitaly/hook/update.go
@@ -23,7 +23,10 @@ func (m *GitLabHookManager) UpdateHook(ctx context.Context, repo *gitalypb.Repos
// If the update hook declines the push, then we need
// to stop any secondaries voting on the transaction.
- m.stopTransaction(ctx, payload)
+ if err := m.stopTransaction(ctx, payload); err != nil {
+ ctxlogrus.Extract(ctx).WithError(err).Error("failed stopping transaction in update hook")
+ }
+
return err
}
}