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-01 14:08:25 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-02-01 14:08:25 +0300
commitf89bdb199f5ec6ccd619d8539b160d8ba1dd2714 (patch)
tree57d4294b1c4f25e41fab129a5d6dad059fe01eb1
parent0d8e8d6873722723e085d94af57778674db5f46f (diff)
coordinator: Log when RPC creates no subtransactions
When an transactional RPC creates no subtransactions, then we do not know why that is: it either could be that the RPC is not aware of transactions and thus wasn't able to correctly use transactions, or that some git command didn't use hooks because of a programmatic error, or that the RPC simply didn't change anything. Because we cannot know what happened, we need to assume the worst: that the repository is now out of sync across the replicas. As a logical result, we thus always create a replication job in case no transaction happened to be on the safe side. This replication job is wasteful, as in most cases we probably did perform the changes correctly on all nodes. But because we don't log this, it's hard to observe which RPCs cause this, and thus also hard to fix. So let's improve observability by creating a log entry.
-rw-r--r--internal/praefect/coordinator.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index 4cdf2d8c2..3679bdc9a 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -651,6 +651,8 @@ func (c *Coordinator) createTransactionFinalizer(
// transactions at all. We thus need to assume it changed repository state
// and need to create replication jobs.
if transaction.CountSubtransactions() == 0 {
+ ctxlogrus.Extract(ctx).Info("transaction did not create subtransactions")
+
secondaries := make([]string, 0, len(nodeStates))
for secondary := range nodeStates {
if secondary == route.Primary.Storage {