diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2021-07-27 18:30:00 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2021-08-31 15:57:48 +0300 |
commit | 679d591d4dd3510525ef32e6a41376a4ab8b66f3 (patch) | |
tree | 5e96d88f5b07bb13efbe4889eeb185277698bd3f /cmd | |
parent | 6556805a5fb74f6410c912a947ba0a76ad7da12b (diff) |
Link records with repository ID in CreateRepository
When a repository is being created, all of the records need to be connected
via the repository ID. This commit expands CreateRepository to take in the
repository ID Praefect reserved for the repository while routing the creation
request. CreateRepository then links all of the records it creates via the
repository id. While the repository ID is not really used for anything yet, the
newly created records being linked via the ID allow us to run a migration in the
following record to just link all existing records correctly via the repository
ID. Any concurrently created records would already be linked correctly by the code
added in this commit.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/praefect/subcmd_accept_dataloss_test.go | 2 | ||||
-rw-r--r-- | cmd/praefect/subcmd_set_replication_factor_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/cmd/praefect/subcmd_accept_dataloss_test.go b/cmd/praefect/subcmd_accept_dataloss_test.go index cb3e9bf2b..2945b43f1 100644 --- a/cmd/praefect/subcmd_accept_dataloss_test.go +++ b/cmd/praefect/subcmd_accept_dataloss_test.go @@ -47,7 +47,7 @@ func TestAcceptDatalossSubcommand(t *testing.T) { if !repoCreated { repoCreated = true - require.NoError(t, rs.CreateRepository(ctx, vs, repo, storage, nil, nil, false, false)) + require.NoError(t, rs.CreateRepository(ctx, 1, vs, repo, storage, nil, nil, false, false)) } require.NoError(t, rs.SetGeneration(ctx, vs, repo, storage, generation)) diff --git a/cmd/praefect/subcmd_set_replication_factor_test.go b/cmd/praefect/subcmd_set_replication_factor_test.go index 5b0d07605..197045a55 100644 --- a/cmd/praefect/subcmd_set_replication_factor_test.go +++ b/cmd/praefect/subcmd_set_replication_factor_test.go @@ -92,7 +92,7 @@ func TestSetReplicationFactorSubcommand(t *testing.T) { // create a repository record require.NoError(t, - datastore.NewPostgresRepositoryStore(db, nil).CreateRepository(ctx, "virtual-storage", "relative-path", "primary", nil, nil, false, false), + datastore.NewPostgresRepositoryStore(db, nil).CreateRepository(ctx, 1, "virtual-storage", "relative-path", "primary", nil, nil, false, false), ) ln, clean := listenAndServe(t, []svcRegistrar{registerPraefectInfoServer( |