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-04-01 11:29:03 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-04-06 10:26:32 +0300
commit09d1c62998b04a413d6a0763921f7965cef916f5 (patch)
tree017d140fdbbfb21a212a59344f6ac4f5c8a05132 /internal/praefect/replicator_test.go
parentc52ea806eda8fadc6498f70a379f328b0f82e17f (diff)
remote: Use atomic fetch in `FetchInternalRemote()`
Transactional behaviour for fetches had to be disabled at some point because the reference-transaction hook was executed once per updated reference. Naturally, this can be extremely expensive in cases where thousands of references are updated, leading to thousands of votes. Since then, we've upstreamed a new `--atomic` flag into git, which has been released with git v2.31.0. With this flag, all references are updated in a single transaction in an all-or-nothing fashion. Which effectively also means that the reference-transaction hook is now executed once, only. Enable this behaviour in `FetchInternalRemote()` if the current git version supports it. The side effect of making the fetch now an all-or-nothing operation shouldn't cause any issues for us here given that we use a forced refspec anyway.
Diffstat (limited to 'internal/praefect/replicator_test.go')
-rw-r--r--internal/praefect/replicator_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go
index 82e7bfc57..a507ee9e8 100644
--- a/internal/praefect/replicator_test.go
+++ b/internal/praefect/replicator_test.go
@@ -21,7 +21,9 @@ import (
"gitlab.com/gitlab-org/gitaly/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/internal/git/objectpool"
gitaly_config "gitlab.com/gitlab-org/gitaly/internal/gitaly/config"
+ hook_manager "gitlab.com/gitlab-org/gitaly/internal/gitaly/hook"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/rubyserver"
+ "gitlab.com/gitlab-org/gitaly/internal/gitaly/service/hook"
objectpoolservice "gitlab.com/gitlab-org/gitaly/internal/gitaly/service/objectpool"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/ref"
"gitlab.com/gitlab-org/gitaly/internal/gitaly/service/remote"
@@ -1055,6 +1057,7 @@ func newReplicationService(tb testing.TB) (*grpc.Server, string) {
locator := gitaly_config.NewLocator(gitaly_config.Config)
txManager := transaction.NewManager(gitaly_config.Config)
+ hookManager := hook_manager.NewManager(locator, txManager, hook_manager.GitlabAPIStub, gitaly_config.Config)
gitCmdFactory := git.NewExecCommandFactory(gitaly_config.Config)
gitalypb.RegisterRepositoryServiceServer(svr, repository.NewServer(gitaly_config.Config, RubyServer, locator, txManager, gitCmdFactory))
@@ -1062,6 +1065,7 @@ func newReplicationService(tb testing.TB) (*grpc.Server, string) {
gitalypb.RegisterRemoteServiceServer(svr, remote.NewServer(gitaly_config.Config, RubyServer, locator, gitCmdFactory))
gitalypb.RegisterSSHServiceServer(svr, ssh.NewServer(gitaly_config.Config, locator, gitCmdFactory))
gitalypb.RegisterRefServiceServer(svr, ref.NewServer(gitaly_config.Config, locator, gitCmdFactory))
+ gitalypb.RegisterHookServiceServer(svr, hook.NewServer(gitaly_config.Config, hookManager, gitCmdFactory))
healthpb.RegisterHealthServer(svr, health.NewServer())
reflection.Register(svr)