diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-24 13:01:25 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-24 13:01:25 +0300 |
commit | f6960a410486bad8792ec947824a0c591675749e (patch) | |
tree | 09069bad0f2710569630c4919b0b0858c49c599a | |
parent | ed7f8b993280a89b23d10eaaa286a0b4f3f604de (diff) | |
parent | 11848b26f0fa37c162078baaf8d128c7915c9bc8 (diff) |
Merge branch 'pks-coordinator-log-replication-cause' into 'master'
coordinator: Log cause of queued replication events
See merge request gitlab-org/gitaly!3190
-rw-r--r-- | internal/praefect/coordinator.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go index 71c6b1a95..206c040e8 100644 --- a/internal/praefect/coordinator.go +++ b/internal/praefect/coordinator.go @@ -464,7 +464,7 @@ func (c *Coordinator) mutatorStreamParameters(ctx context.Context, call grpcCall finalizers = append(finalizers, c.createTransactionFinalizer(ctx, transaction, route, virtualStorage, - targetRepo, change, params, nodeErrors), + targetRepo, change, params, call.fullMethodName, nodeErrors), ) } else { finalizers = append(finalizers, @@ -477,6 +477,7 @@ func (c *Coordinator) mutatorStreamParameters(ctx context.Context, call grpcCall append(routerNodesToStorages(route.Secondaries), route.ReplicationTargets...), change, params, + call.fullMethodName, )) } @@ -687,6 +688,7 @@ func (c *Coordinator) createTransactionFinalizer( targetRepo *gitalypb.Repository, change datastore.ChangeType, params datastore.Params, + cause string, nodeErrors *nodeErrors, ) func() error { return func() error { @@ -694,7 +696,7 @@ func (c *Coordinator) createTransactionFinalizer( return c.newRequestFinalizer( ctx, virtualStorage, targetRepo, route.Primary.Storage, - updated, outdated, change, params)() + updated, outdated, change, params, cause)() } } @@ -800,8 +802,14 @@ func (c *Coordinator) newRequestFinalizer( outdatedSecondaries []string, change datastore.ChangeType, params datastore.Params, + cause string, ) func() error { return func() error { + ctxlogrus.Extract(ctx).WithFields(logrus.Fields{ + "replication.cause": cause, + "replication.type": change, + }).Info("queueing replication job") + switch change { case datastore.UpdateRepo: // If this fails, the primary might have changes on it that are not recorded in the database. The secondaries will appear |