From 4238815b1e9fd69ee699ee827385b3e851afbdea Mon Sep 17 00:00:00 2001 From: Sami Hiltunen Date: Tue, 30 Mar 2021 14:56:33 +0200 Subject: Enable reference transaction voting via backchannels This commit implements backchannel voting support in Gitaly behind the 'gitaly_backchannel_voting' feature flag. Historically, Gitaly has used Praefect provided details to dial back to the Praefect to cast votes. This has been problematic due to the address provided by Praefect not always being reachable by Gitaly. To solve the dialing problems, connection multiplexing was implemented between Gitaly and Praefect to allow Gitaly to communicate withe the TransactionService in Praefect via the same connection Praefect established to Gitaly. When the feature flags is enabled, Gitaly uses the 'backchannel' connection instead of connecting to the Praefect using the Praefect provided details. --- cmd/gitaly-hooks/hooks_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd/gitaly-hooks') diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go index 5e93a7b49..da3040ac0 100644 --- a/cmd/gitaly-hooks/hooks_test.go +++ b/cmd/gitaly-hooks/hooks_test.go @@ -584,10 +584,11 @@ func runHookServiceServer(t *testing.T, cfg config.Cfg) func() { } func runHookServiceServerWithAPI(t *testing.T, cfg config.Cfg, gitlabAPI gitalyhook.GitlabAPI) func() { - txManager := transaction.NewManager(cfg, backchannel.NewRegistry()) + registry := backchannel.NewRegistry() + txManager := transaction.NewManager(cfg, registry) hookManager := gitalyhook.NewManager(config.NewLocator(cfg), txManager, gitlabAPI, cfg) gitCmdFactory := git.NewExecCommandFactory(cfg) - server := testhelper.NewServerWithAuth(t, nil, nil, cfg.Auth.Token, testhelper.WithInternalSocket(cfg)) + server := testhelper.NewServerWithAuth(t, nil, nil, cfg.Auth.Token, registry, testhelper.WithInternalSocket(cfg)) gitalypb.RegisterHookServiceServer(server.GrpcServer(), hook.NewServer(cfg, hookManager, gitCmdFactory)) reflection.Register(server.GrpcServer()) -- cgit v1.2.3