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
path: root/cmd
diff options
context:
space:
mode:
authorSami Hiltunen <shiltunen@gitlab.com>2021-03-26 11:32:21 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-04-01 12:50:52 +0300
commit9c08dc0188e1a00866c9c1361bfd67862bec01d7 (patch)
tree409b059fcffbef061ecf7d3414339b39ca8d766a /cmd
parent54f0de751b48b23424640cd851a8222b5025f6bc (diff)
Inject PrimaryGetter and Connection in Praefect's Info server
This commit wires up a PrimaryGetter and Connections into Praefect's Info server as they'll be needed when converting the methods to support variable replication factor and repository specific primaries. ReplicationFactorSetter is also converted into AssignmentStore so the methods can acccess assignments later.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/praefect/main.go5
-rw-r--r--cmd/praefect/subcmd_accept_dataloss_test.go2
-rw-r--r--cmd/praefect/subcmd_dataloss_test.go2
-rw-r--r--cmd/praefect/subcmd_set_replication_factor_test.go2
4 files changed, 8 insertions, 3 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index 0e229b8fb..4daafd172 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -304,6 +304,7 @@ func run(cfgs []starter.Config, conf config.Config) error {
healthChecker praefect.HealthChecker
nodeSet praefect.NodeSet
router praefect.Router
+ primaryGetter praefect.PrimaryGetter
)
if conf.Failover.ElectionStrategy == config.ElectionStrategyPerRepository {
nodeSet, err = praefect.DialNodes(ctx, conf.VirtualStorages, protoregistry.GitalyProtoPreregistered, errTracker)
@@ -327,6 +328,7 @@ func run(cfgs []starter.Config, conf config.Config) error {
}
}()
+ primaryGetter = elector
assignmentStore = datastore.NewAssignmentStore(db, conf.StorageNames())
router = praefect.NewPerRepositoryRouter(
@@ -342,6 +344,7 @@ func run(cfgs []starter.Config, conf config.Config) error {
healthChecker = praefect.HealthChecker(nodeManager)
nodeSet = praefect.NodeSetFromNodeManager(nodeManager)
router = praefect.NewNodeManagerRouter(nodeManager, rs)
+ primaryGetter = nodeManager
nodeManager.Start(conf.Failover.BootstrapInterval.Duration(), conf.Failover.MonitorInterval.Duration())
}
@@ -383,6 +386,8 @@ func run(cfgs []starter.Config, conf config.Config) error {
rs,
assignmentStore,
protoregistry.GitalyProtoPreregistered,
+ nodeSet.Connections(),
+ primaryGetter,
)
)
metricsCollectors = append(metricsCollectors, transactionManager, coordinator, repl)
diff --git a/cmd/praefect/subcmd_accept_dataloss_test.go b/cmd/praefect/subcmd_accept_dataloss_test.go
index 7927df9dc..3c3ae6259 100644
--- a/cmd/praefect/subcmd_accept_dataloss_test.go
+++ b/cmd/praefect/subcmd_accept_dataloss_test.go
@@ -61,7 +61,7 @@ func TestAcceptDatalossSubcommand(t *testing.T) {
},
}
- ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(info.NewServer(nil, conf, q, rs, nil))})
+ ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(info.NewServer(nil, conf, q, rs, nil, nil, nil))})
defer clean()
conf.SocketPath = ln.Addr().String()
diff --git a/cmd/praefect/subcmd_dataloss_test.go b/cmd/praefect/subcmd_dataloss_test.go
index 14ae43a57..3c67783d5 100644
--- a/cmd/praefect/subcmd_dataloss_test.go
+++ b/cmd/praefect/subcmd_dataloss_test.go
@@ -109,7 +109,7 @@ func TestDatalossSubcommand(t *testing.T) {
require.NoError(t, gs.SetGeneration(ctx, "virtual-storage-1", "repository-2", "gitaly-3", 0))
ln, clean := listenAndServe(t, []svcRegistrar{
- registerPraefectInfoServer(info.NewServer(nil, cfg, nil, gs, nil))})
+ registerPraefectInfoServer(info.NewServer(nil, cfg, nil, gs, nil, nil, nil))})
defer clean()
for _, tc := range []struct {
desc string
diff --git a/cmd/praefect/subcmd_set_replication_factor_test.go b/cmd/praefect/subcmd_set_replication_factor_test.go
index 090da41ee..e830450e5 100644
--- a/cmd/praefect/subcmd_set_replication_factor_test.go
+++ b/cmd/praefect/subcmd_set_replication_factor_test.go
@@ -93,7 +93,7 @@ func TestSetReplicationFactorSubcommand(t *testing.T) {
)
ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer(
- info.NewServer(nil, config.Config{}, nil, nil, store),
+ info.NewServer(nil, config.Config{}, nil, nil, store, nil, nil),
)})
defer clean()