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>2022-03-16 14:38:34 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-03-23 17:29:35 +0300
commitf1273ea018a7240833cb6c39f17002270110d3e3 (patch)
treeb35da63f4b620f1f30283ca6e64364c6d1b9fafc
parent3933a562cea2c0e9c5626e7066b5142014597cf3 (diff)
proto: Mark related RPCs as maintenance operationspks-proto-introduce-maintenance-operations
We've got all the infrastructure in place now to handle maintenance operations specially in our infrastructure. Mark all RPCs which are maintenance-related as maintenance operations to switch them to use the new infrastucture. Note that we've still got a feature flag which toggles between old and new routing behaviour for these RPCs. Changelog: changed
-rw-r--r--internal/git/gittest/delta_islands.go2
-rw-r--r--internal/gitaly/service/ref/pack_refs_test.go22
-rw-r--r--internal/gitaly/service/repository/cleanup_test.go33
-rw-r--r--internal/gitaly/service/repository/commit_graph_test.go26
-rw-r--r--internal/gitaly/service/repository/gc_test.go77
-rw-r--r--internal/gitaly/service/repository/midx_test.go31
-rw-r--r--internal/gitaly/service/repository/optimize_test.go23
-rw-r--r--internal/gitaly/service/repository/prune_unreachable_objects_test.go9
-rw-r--r--internal/gitaly/service/repository/repack_test.go65
-rw-r--r--internal/praefect/coordinator.go17
-rw-r--r--internal/praefect/coordinator_test.go17
-rw-r--r--internal/praefect/protoregistry/protoregistry_test.go14
-rw-r--r--internal/praefect/replicator_test.go38
-rw-r--r--proto/go/gitalypb/ref.pb.go2
-rw-r--r--proto/go/gitalypb/repository-service.pb.go16
-rw-r--r--proto/ref.proto2
-rw-r--r--proto/repository-service.proto16
17 files changed, 309 insertions, 101 deletions
diff --git a/internal/git/gittest/delta_islands.go b/internal/git/gittest/delta_islands.go
index 286e40389..23f2e8884 100644
--- a/internal/git/gittest/delta_islands.go
+++ b/internal/git/gittest/delta_islands.go
@@ -15,6 +15,8 @@ import (
// TestDeltaIslands is based on the tests in
// https://github.com/git/git/blob/master/t/t5320-delta-islands.sh .
func TestDeltaIslands(t *testing.T, cfg config.Cfg, repoPath string, repack func() error) {
+ t.Helper()
+
// Create blobs that we expect Git to use delta compression on.
blob1, err := io.ReadAll(io.LimitReader(rand.Reader, 100000))
require.NoError(t, err)
diff --git a/internal/gitaly/service/ref/pack_refs_test.go b/internal/gitaly/service/ref/pack_refs_test.go
index f16aa8175..e6da2b733 100644
--- a/internal/gitaly/service/ref/pack_refs_test.go
+++ b/internal/gitaly/service/ref/pack_refs_test.go
@@ -2,6 +2,7 @@ package ref
import (
"bufio"
+ "context"
"fmt"
"os"
"path/filepath"
@@ -13,6 +14,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/localrepo"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -20,7 +22,12 @@ import (
)
func TestPackRefsSuccessfulRequest(t *testing.T) {
- ctx := testhelper.Context(t)
+ t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPackRefsSuccessfulRequest)
+}
+
+func testPackRefsSuccessfulRequest(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, repoProto, repoPath, client := setupRefService(ctx, t)
@@ -67,9 +74,19 @@ func linesInPackfile(t *testing.T, repoPath string) int {
func TestPackRefs_invalidRequest(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPackRefsInvalidRequest)
+}
+
+func testPackRefsInvalidRequest(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRefServiceWithoutRepo(t)
+ praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`
+ if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
+ praefectErr = `routing repository maintenance: getting repository metadata: repository not found`
+ }
+
tests := []struct {
repo *gitalypb.Repository
err error
@@ -92,7 +109,7 @@ func TestPackRefs_invalidRequest(t *testing.T) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
- `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`,
+ praefectErr,
),
),
},
@@ -100,7 +117,6 @@ func TestPackRefs_invalidRequest(t *testing.T) {
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
- ctx := testhelper.Context(t)
//nolint:staticcheck
_, err := client.PackRefs(ctx, &gitalypb.PackRefsRequest{Repository: tc.repo})
testhelper.RequireGrpcError(t, err, tc.err)
diff --git a/internal/gitaly/service/repository/cleanup_test.go b/internal/gitaly/service/repository/cleanup_test.go
index 1802fee12..50fc670ce 100644
--- a/internal/gitaly/service/repository/cleanup_test.go
+++ b/internal/gitaly/service/repository/cleanup_test.go
@@ -1,6 +1,7 @@
package repository
import (
+ "context"
"fmt"
"os"
"path/filepath"
@@ -10,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -24,6 +26,11 @@ const (
// https://gitlab.com/gitlab-org/gitaly/issues/1750
func TestCleanupDeletesStaleWorktrees(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupDeletesStaleWorktrees)
+}
+
+func testCleanupDeletesStaleWorktrees(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
testCases := []struct {
@@ -50,7 +57,6 @@ func TestCleanupDeletesStaleWorktrees(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- ctx := testhelper.Context(t)
repo, repoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{
Seed: gittest.SeedGitLabTest,
})
@@ -86,8 +92,12 @@ func TestCleanupDeletesStaleWorktrees(t *testing.T) {
func TestCleanupDeletesOrphanedWorktrees(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupDeletesOrphanedWorktrees)
+}
+
+func testCleanupDeletesOrphanedWorktrees(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
worktreeCheckoutPath := filepath.Join(repoPath, worktreePrefix, "test-worktree")
@@ -110,12 +120,16 @@ func TestCleanupDeletesOrphanedWorktrees(t *testing.T) {
// https://gitlab.com/gitlab-org/gitaly/issues/1750
func TestCleanupDisconnectedWorktrees(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupDisconnectedWorktrees)
+}
+
+func testCleanupDisconnectedWorktrees(t *testing.T, ctx context.Context) {
+ t.Parallel()
const (
worktreeName = "test-worktree"
worktreeAdminDir = "worktrees"
)
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
worktreePath := filepath.Join(repoPath, worktreePrefix, worktreeName)
@@ -151,10 +165,19 @@ func TestCleanupDisconnectedWorktrees(t *testing.T) {
func TestCleanup_invalidRequest(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupInvalidRequest)
+}
+
+func testCleanupInvalidRequest(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
+ praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"so/me/some.git" not found`
+ if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
+ praefectErr = `routing repository maintenance: getting repository metadata: repository not found`
+ }
+
for _, tc := range []struct {
desc string
in *gitalypb.Repository
@@ -176,7 +199,7 @@ func TestCleanup_invalidRequest(t *testing.T) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: %q`, filepath.Join(cfg.Storages[0].Path, "so/me/some.git")),
- `mutator call: route repository mutator: get repository id: repository "default"/"so/me/some.git" not found`,
+ praefectErr,
),
),
},
diff --git a/internal/gitaly/service/repository/commit_graph_test.go b/internal/gitaly/service/repository/commit_graph_test.go
index c55c64665..b50f520dd 100644
--- a/internal/gitaly/service/repository/commit_graph_test.go
+++ b/internal/gitaly/service/repository/commit_graph_test.go
@@ -2,6 +2,7 @@ package repository
import (
"bytes"
+ "context"
"fmt"
"os"
"path/filepath"
@@ -11,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/stats"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
@@ -20,8 +22,12 @@ import (
func TestWriteCommitGraph_withExistingCommitGraphCreatedWithDefaults(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testWriteCommitGraphWithExistingCommitGraphCreatedWithDefaults)
+}
+
+func testWriteCommitGraphWithExistingCommitGraphCreatedWithDefaults(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
commitGraphPath := filepath.Join(repoPath, stats.CommitGraphRelPath)
@@ -58,8 +64,12 @@ func TestWriteCommitGraph_withExistingCommitGraphCreatedWithDefaults(t *testing.
func TestWriteCommitGraph_withExistingCommitGraphCreatedWithSplit(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testWriteCommitGraphWithExistingCommitGraphCreatedWithSplit)
+}
+
+func testWriteCommitGraphWithExistingCommitGraphCreatedWithSplit(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
commitGraphPath := filepath.Join(repoPath, stats.CommitGraphRelPath)
@@ -96,8 +106,12 @@ func TestWriteCommitGraph_withExistingCommitGraphCreatedWithSplit(t *testing.T)
func TestWriteCommitGraph(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testWriteCommitGraph)
+}
+
+func testWriteCommitGraph(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
chainPath := filepath.Join(repoPath, stats.CommitGraphChainRelPath)
@@ -160,8 +174,12 @@ func TestWriteCommitGraph_validationChecks(t *testing.T) {
func TestUpdateCommitGraph(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testUpdateCommitGraph)
+}
+
+func testUpdateCommitGraph(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
chainPath := filepath.Join(repoPath, stats.CommitGraphChainRelPath)
diff --git a/internal/gitaly/service/repository/gc_test.go b/internal/gitaly/service/repository/gc_test.go
index 2849a12fb..3308110bd 100644
--- a/internal/gitaly/service/repository/gc_test.go
+++ b/internal/gitaly/service/repository/gc_test.go
@@ -1,6 +1,7 @@
package repository
import (
+ "context"
"fmt"
"os"
"path/filepath"
@@ -15,6 +16,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/stats"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
@@ -30,8 +32,12 @@ var (
func TestGarbageCollectCommitGraph(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectCommitGraph)
+}
+
+func testGarbageCollectCommitGraph(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
//nolint:staticcheck
@@ -45,8 +51,12 @@ func TestGarbageCollectCommitGraph(t *testing.T) {
func TestGarbageCollectSuccess(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectSuccess)
+}
+
+func testGarbageCollectSuccess(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
tests := []struct {
@@ -98,7 +108,11 @@ func TestGarbageCollectSuccess(t *testing.T) {
func TestGarbageCollectWithPrune(t *testing.T) {
t.Parallel()
- ctx := testhelper.Context(t)
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectWithPrune)
+}
+
+func testGarbageCollectWithPrune(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
@@ -110,7 +124,7 @@ func TestGarbageCollectWithPrune(t *testing.T) {
// create a reference to the blob, so it should not be removed by gc
gittest.WriteCommit(t, cfg, repoPath,
gittest.WithTreeEntries(gittest.TreeEntry{
- OID: git.ObjectID(blobHashes[2]), Path: t.Name(), Mode: "100644",
+ OID: git.ObjectID(blobHashes[2]), Path: "blob-name", Mode: "100644",
}),
)
@@ -141,7 +155,11 @@ func TestGarbageCollectWithPrune(t *testing.T) {
func TestGarbageCollectLogStatistics(t *testing.T) {
t.Parallel()
- ctx := testhelper.Context(t)
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectLogStatistics)
+}
+
+func testGarbageCollectLogStatistics(t *testing.T, ctx context.Context) {
+ t.Parallel()
logger, hook := test.NewNullLogger()
_, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger))
@@ -155,8 +173,12 @@ func TestGarbageCollectLogStatistics(t *testing.T) {
func TestGarbageCollectDeletesRefsLocks(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesRefsLocks)
+}
+
+func testGarbageCollectDeletesRefsLocks(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
req := &gitalypb.GarbageCollectRequest{Repository: repo}
@@ -197,6 +219,11 @@ func TestGarbageCollectDeletesRefsLocks(t *testing.T) {
func TestGarbageCollectDeletesPackedRefsLock(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesPackedRefsLock)
+}
+
+func testGarbageCollectDeletesPackedRefsLock(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
testCases := []struct {
@@ -223,7 +250,6 @@ func TestGarbageCollectDeletesPackedRefsLock(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- ctx := testhelper.Context(t)
repo, repoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{
Seed: gittest.SeedGitLabTest,
})
@@ -264,8 +290,12 @@ func TestGarbageCollectDeletesPackedRefsLock(t *testing.T) {
func TestGarbageCollectDeletesFileLocks(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesFileLocks)
+}
+
+func testGarbageCollectDeletesFileLocks(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
req := &gitalypb.GarbageCollectRequest{Repository: repo}
@@ -301,6 +331,11 @@ func TestGarbageCollectDeletesFileLocks(t *testing.T) {
func TestGarbageCollectDeletesPackedRefsNew(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesPackedRefsNew)
+}
+
+func testGarbageCollectDeletesPackedRefsNew(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
testCases := []struct {
@@ -326,7 +361,6 @@ func TestGarbageCollectDeletesPackedRefsNew(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
- ctx := testhelper.Context(t)
repo, repoPath := gittest.CreateRepository(ctx, t, cfg)
req := &gitalypb.GarbageCollectRequest{Repository: repo}
@@ -356,11 +390,20 @@ func TestGarbageCollectDeletesPackedRefsNew(t *testing.T) {
func TestGarbageCollectFailure(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectFailure)
+}
+
+func testGarbageCollectFailure(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
storagePath := strings.TrimSuffix(repoPath, "/"+repo.RelativePath)
+ praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`
+ if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
+ praefectErr = `routing repository maintenance: getting repository metadata: repository not found`
+ }
+
tests := []struct {
repo *gitalypb.Repository
err error
@@ -379,7 +422,7 @@ func TestGarbageCollectFailure(t *testing.T) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, storagePath),
- `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`,
+ praefectErr,
),
),
},
@@ -396,8 +439,12 @@ func TestGarbageCollectFailure(t *testing.T) {
func TestCleanupInvalidKeepAroundRefs(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testCleanupInvalidKeepAroundRefs)
+}
+
+func testCleanupInvalidKeepAroundRefs(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
// Make the directory, so we can create random reflike things in it
@@ -491,8 +538,12 @@ func mustCreateFileWithTimes(t testing.TB, path string, mTime time.Time) {
func TestGarbageCollectDeltaIslands(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeltaIslands)
+}
+
+func testGarbageCollectDeltaIslands(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
gittest.TestDeltaIslands(t, cfg, repoPath, func() error {
diff --git a/internal/gitaly/service/repository/midx_test.go b/internal/gitaly/service/repository/midx_test.go
index 984f4ee44..d0bea2ca0 100644
--- a/internal/gitaly/service/repository/midx_test.go
+++ b/internal/gitaly/service/repository/midx_test.go
@@ -17,6 +17,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v14/internal/metadata"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/internal/transaction/txinfo"
@@ -28,8 +29,12 @@ import (
func TestMidxWrite(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxWrite)
+}
+
+func testMidxWrite(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
//nolint:staticcheck
@@ -47,8 +52,12 @@ func TestMidxWrite(t *testing.T) {
func TestMidxRewrite(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRewrite)
+}
+
+func testMidxRewrite(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
midxPath := filepath.Join(repoPath, MidxRelPath)
@@ -75,8 +84,12 @@ func TestMidxRewrite(t *testing.T) {
func TestMidxRepack(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepack)
+}
+
+func testMidxRepack(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
// add some pack files with different sizes
@@ -115,7 +128,11 @@ func TestMidxRepack(t *testing.T) {
func TestMidxRepack_transactional(t *testing.T) {
t.Parallel()
- ctx := testhelper.Context(t)
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepackTransactional)
+}
+
+func testMidxRepackTransactional(t *testing.T, ctx context.Context) {
+ t.Parallel()
txManager := transaction.NewTrackingManager()
@@ -145,12 +162,16 @@ func TestMidxRepack_transactional(t *testing.T) {
func TestMidxRepackExpire(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepackExpire)
+}
+
+func testMidxRepackExpire(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
for _, packsAdded := range []int{3, 5, 11, 20} {
t.Run(fmt.Sprintf("Test repack expire with %d added packs", packsAdded),
func(t *testing.T) {
- ctx := testhelper.Context(t)
repo, repoPath := gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{
Seed: gittest.SeedGitLabTest,
})
diff --git a/internal/gitaly/service/repository/optimize_test.go b/internal/gitaly/service/repository/optimize_test.go
index 0bc1932d5..db9071dbf 100644
--- a/internal/gitaly/service/repository/optimize_test.go
+++ b/internal/gitaly/service/repository/optimize_test.go
@@ -2,6 +2,7 @@ package repository
import (
"bytes"
+ "context"
"fmt"
"os"
"path/filepath"
@@ -12,6 +13,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/stats"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
"google.golang.org/grpc/codes"
@@ -42,8 +44,12 @@ func getNewestPackfileModtime(t *testing.T, repoPath string) time.Time {
func TestOptimizeRepository(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testOptimizeRepository)
+}
+
+func testOptimizeRepository(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repoProto, repoPath, client := setupRepositoryService(ctx, t)
gittest.Exec(t, cfg, "-C", repoPath, "repack", "-A", "-b")
@@ -151,10 +157,19 @@ func TestOptimizeRepository(t *testing.T) {
func TestOptimizeRepositoryValidation(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testOptimizeRepositoryValidation)
+}
+
+func testOptimizeRepositoryValidation(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, _, client := setupRepositoryService(ctx, t)
+ praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"path/not/exist" not found`
+ if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
+ praefectErr = `routing repository maintenance: getting repository metadata: repository not found`
+ }
+
testCases := []struct {
desc string
repo *gitalypb.Repository
@@ -177,7 +192,7 @@ func TestOptimizeRepositoryValidation(t *testing.T) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/path/not/exist"`, cfg.Storages[0].Path),
- `mutator call: route repository mutator: get repository id: repository "default"/"path/not/exist" not found`,
+ praefectErr,
),
),
},
@@ -187,7 +202,7 @@ func TestOptimizeRepositoryValidation(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
_, err := client.OptimizeRepository(ctx, &gitalypb.OptimizeRepositoryRequest{Repository: tc.repo})
require.Error(t, err)
- testhelper.RequireGrpcError(t, err, tc.exp)
+ testhelper.RequireGrpcError(t, tc.exp, err)
})
}
diff --git a/internal/gitaly/service/repository/prune_unreachable_objects_test.go b/internal/gitaly/service/repository/prune_unreachable_objects_test.go
index 3d1d6c1f8..b02aa224e 100644
--- a/internal/gitaly/service/repository/prune_unreachable_objects_test.go
+++ b/internal/gitaly/service/repository/prune_unreachable_objects_test.go
@@ -1,6 +1,7 @@
package repository
import (
+ "context"
"os"
"path/filepath"
"testing"
@@ -10,12 +11,18 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
)
func TestPruneUnreachableObjects(t *testing.T) {
- ctx := testhelper.Context(t)
+ t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPruneUnreachableObjects)
+}
+
+func testPruneUnreachableObjects(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go
index 7e73290a6..64e4ee82d 100644
--- a/internal/gitaly/service/repository/repack_test.go
+++ b/internal/gitaly/service/repository/repack_test.go
@@ -1,6 +1,7 @@
package repository
import (
+ "context"
"fmt"
"path/filepath"
"testing"
@@ -12,6 +13,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v14/internal/git/stats"
+ "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testserver"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
@@ -21,8 +23,12 @@ import (
func TestRepackIncrementalSuccess(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalSuccess)
+}
+
+func testRepackIncrementalSuccess(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
_, repo, repoPath, client := setupRepositoryService(ctx, t)
packPath := filepath.Join(repoPath, "objects", "pack")
@@ -48,7 +54,11 @@ func TestRepackIncrementalSuccess(t *testing.T) {
func TestRepackIncrementalCollectLogStatistics(t *testing.T) {
t.Parallel()
- ctx := testhelper.Context(t)
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalCollectLogStatistics)
+}
+
+func testRepackIncrementalCollectLogStatistics(t *testing.T, ctx context.Context) {
+ t.Parallel()
logger, hook := test.NewNullLogger()
_, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger))
@@ -62,8 +72,12 @@ func TestRepackIncrementalCollectLogStatistics(t *testing.T) {
func TestRepackLocal(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackLocal)
+}
+
+func testRepackLocal(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
altObjectsDir := "./alt-objects"
@@ -99,8 +113,18 @@ func TestRepackLocal(t *testing.T) {
func TestRepackIncrementalFailure(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalFailure)
+}
+
+func testRepackIncrementalFailure(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
+ praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`
+ if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
+ praefectErr = `routing repository maintenance: getting repository metadata: repository not found`
+ }
+
tests := []struct {
repo *gitalypb.Repository
err error
@@ -128,7 +152,7 @@ func TestRepackIncrementalFailure(t *testing.T) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
- `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`,
+ praefectErr,
),
),
},
@@ -136,7 +160,6 @@ func TestRepackIncrementalFailure(t *testing.T) {
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
- ctx := testhelper.Context(t)
//nolint:staticcheck
_, err := client.RepackIncremental(ctx, &gitalypb.RepackIncrementalRequest{Repository: tc.repo})
testhelper.RequireGrpcError(t, err, tc.err)
@@ -146,6 +169,11 @@ func TestRepackIncrementalFailure(t *testing.T) {
func TestRepackFullSuccess(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullSuccess)
+}
+
+func testRepackFullSuccess(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
tests := []struct {
@@ -158,8 +186,6 @@ func TestRepackFullSuccess(t *testing.T) {
for _, test := range tests {
t.Run(test.desc, func(t *testing.T) {
- ctx := testhelper.Context(t)
-
var repoPath string
test.req.Repository, repoPath = gittest.CreateRepository(ctx, t, cfg, gittest.CreateRepositoryConfig{
Seed: gittest.SeedGitLabTest,
@@ -202,7 +228,11 @@ func TestRepackFullSuccess(t *testing.T) {
func TestRepackFullCollectLogStatistics(t *testing.T) {
t.Parallel()
- ctx := testhelper.Context(t)
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullCollectLogStatistics)
+}
+
+func testRepackFullCollectLogStatistics(t *testing.T, ctx context.Context) {
+ t.Parallel()
logger, hook := test.NewNullLogger()
_, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger))
@@ -243,8 +273,18 @@ func doBitmapsContainHashCache(t *testing.T, bitmapPaths []string) {
func TestRepackFullFailure(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullFailure)
+}
+
+func testRepackFullFailure(t *testing.T, ctx context.Context) {
+ t.Parallel()
cfg, client := setupRepositoryServiceWithoutRepo(t)
+ praefectErr := `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`
+ if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
+ praefectErr = `routing repository maintenance: getting repository metadata: repository not found`
+ }
+
tests := []struct {
desc string
repo *gitalypb.Repository
@@ -272,7 +312,7 @@ func TestRepackFullFailure(t *testing.T) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
- `mutator call: route repository mutator: get repository id: repository "default"/"bar" not found`,
+ praefectErr,
),
),
},
@@ -280,7 +320,6 @@ func TestRepackFullFailure(t *testing.T) {
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
- ctx := testhelper.Context(t)
//nolint:staticcheck
_, err := client.RepackFull(ctx, &gitalypb.RepackFullRequest{Repository: tc.repo})
testhelper.RequireGrpcError(t, err, tc.err)
@@ -290,8 +329,12 @@ func TestRepackFullFailure(t *testing.T) {
func TestRepackFullDeltaIslands(t *testing.T) {
t.Parallel()
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullDeltaIslands)
+}
+
+func testRepackFullDeltaIslands(t *testing.T, ctx context.Context) {
+ t.Parallel()
- ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
gittest.TestDeltaIslands(t, cfg, repoPath, func() error {
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index ad92d8a75..94c004f79 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -92,20 +92,9 @@ var transactionRPCs = map[string]transactionsCondition{
"/gitaly.ObjectPoolService/ReduplicateRepository": transactionsDisabled,
"/gitaly.RepositoryService/RenameRepository": transactionsDisabled,
- // The following list of RPCs are considered idempotent RPCs: while they write into the
- // target repository, this shouldn't ever have any user-visible impact given that they're
- // purely optimizations of the on-disk state. These RPCs are thus treated specially and
- // shouldn't ever cause a repository generation bump.
- "/gitaly.RefService/PackRefs": transactionsDisabled,
- "/gitaly.RepositoryService/Cleanup": transactionsDisabled,
- "/gitaly.RepositoryService/GarbageCollect": transactionsDisabled,
- "/gitaly.RepositoryService/MidxRepack": transactionsDisabled,
- "/gitaly.RepositoryService/OptimizeRepository": transactionsDisabled,
- "/gitaly.RepositoryService/PruneUnreachableObjects": transactionsDisabled,
- "/gitaly.RepositoryService/RepackFull": transactionsDisabled,
- "/gitaly.RepositoryService/RepackIncremental": transactionsDisabled,
- "/gitaly.RepositoryService/RestoreCustomHooks": transactionsDisabled,
- "/gitaly.RepositoryService/WriteCommitGraph": transactionsDisabled,
+ // This RPC call should be made transactional. Furthermore, we should consider whether we
+ // have to replicate custom hooks.
+ "/gitaly.RepositoryService/RestoreCustomHooks": transactionsDisabled,
}
// forcePrimaryRoutingRPCs tracks RPCs which need to always get routed to the primary. This should
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index 0ea9219ba..fd28f29d6 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -115,13 +115,18 @@ func TestStreamDirectorReadOnlyEnforcement(t *testing.T) {
protoregistry.GitalyProtoPreregistered,
)
- frame, err := proto.Marshal(&gitalypb.CleanupRequest{Repository: &gitalypb.Repository{
- StorageName: virtualStorage,
- RelativePath: relativePath,
- }})
+ frame, err := proto.Marshal(&gitalypb.DeleteRefsRequest{
+ Repository: &gitalypb.Repository{
+ StorageName: virtualStorage,
+ RelativePath: relativePath,
+ },
+ Refs: [][]byte{
+ []byte("refs/heads/does-not-exist"),
+ },
+ })
require.NoError(t, err)
- _, err = coordinator.StreamDirector(ctx, "/gitaly.RepositoryService/Cleanup", &mockPeeker{frame: frame})
+ _, err = coordinator.StreamDirector(ctx, "/gitaly.RefService/DeleteRefs", &mockPeeker{frame: frame})
if tc.readOnly {
require.Equal(t, ErrRepositoryReadOnly, err)
testhelper.RequireGrpcCode(t, err, codes.FailedPrecondition)
@@ -494,7 +499,7 @@ func TestStreamDirector_maintenance(t *testing.T) {
queueInterceptor.OnEnqueue(func(context.Context, datastore.ReplicationEvent, datastore.ReplicationEventQueue) (datastore.ReplicationEvent, error) {
require.FailNow(t, "no replication jobs should have been created")
- return datastore.ReplicationEvent{}, fmt.Errorf("unexpected call");
+ return datastore.ReplicationEvent{}, fmt.Errorf("unexpected call")
})
streamParams, err := coordinator.StreamDirector(ctx, methodInfo.FullMethodName(), &mockPeeker{message})
diff --git a/internal/praefect/protoregistry/protoregistry_test.go b/internal/praefect/protoregistry/protoregistry_test.go
index 4ce683c07..89976b7c5 100644
--- a/internal/praefect/protoregistry/protoregistry_test.go
+++ b/internal/praefect/protoregistry/protoregistry_test.go
@@ -92,7 +92,7 @@ func TestNewProtoRegistry(t *testing.T) {
"GetTagMessages": protoregistry.OpAccessor,
"ListBranchNamesContainingCommit": protoregistry.OpAccessor,
"ListTagNamesContainingCommit": protoregistry.OpAccessor,
- "PackRefs": protoregistry.OpMutator,
+ "PackRefs": protoregistry.OpMaintenance,
"RefExists": protoregistry.OpAccessor,
},
"RemoteService": {
@@ -104,7 +104,7 @@ func TestNewProtoRegistry(t *testing.T) {
"ApplyGitattributes": protoregistry.OpMutator,
"BackupCustomHooks": protoregistry.OpAccessor,
"CalculateChecksum": protoregistry.OpAccessor,
- "Cleanup": protoregistry.OpMutator,
+ "Cleanup": protoregistry.OpMaintenance,
"CreateBundle": protoregistry.OpAccessor,
"CreateFork": protoregistry.OpMutator,
"CreateRepository": protoregistry.OpMutator,
@@ -117,16 +117,16 @@ func TestNewProtoRegistry(t *testing.T) {
"FindLicense": protoregistry.OpAccessor,
"FindMergeBase": protoregistry.OpAccessor,
"Fsck": protoregistry.OpAccessor,
- "GarbageCollect": protoregistry.OpMutator,
+ "GarbageCollect": protoregistry.OpMaintenance,
"GetArchive": protoregistry.OpAccessor,
"GetInfoAttributes": protoregistry.OpAccessor,
"GetRawChanges": protoregistry.OpAccessor,
"GetSnapshot": protoregistry.OpAccessor,
"HasLocalBranches": protoregistry.OpAccessor,
- "OptimizeRepository": protoregistry.OpMutator,
- "PruneUnreachableObjects": protoregistry.OpMutator,
- "RepackFull": protoregistry.OpMutator,
- "RepackIncremental": protoregistry.OpMutator,
+ "OptimizeRepository": protoregistry.OpMaintenance,
+ "PruneUnreachableObjects": protoregistry.OpMaintenance,
+ "RepackFull": protoregistry.OpMaintenance,
+ "RepackIncremental": protoregistry.OpMaintenance,
"RepositoryExists": protoregistry.OpAccessor,
"RepositorySize": protoregistry.OpAccessor,
"RestoreCustomHooks": protoregistry.OpMutator,
diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go
index 79e4135d7..6862b2f3f 100644
--- a/internal/praefect/replicator_test.go
+++ b/internal/praefect/replicator_test.go
@@ -2,6 +2,7 @@ package praefect
import (
"context"
+ "fmt"
"path/filepath"
"strings"
"sync"
@@ -283,6 +284,10 @@ func TestReplicatorDowngradeAttempt(t *testing.T) {
}
func TestReplicator_PropagateReplicationJob(t *testing.T) {
+ testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testReplicatorPropagateReplicationJob)
+}
+
+func testReplicatorPropagateReplicationJob(t *testing.T, ctx context.Context) {
t.Parallel()
primaryStorage, secondaryStorage := "internal-gitaly-0", "internal-gitaly-1"
@@ -318,16 +323,29 @@ func TestReplicator_PropagateReplicationJob(t *testing.T) {
// By using WaitGroup we are sure the test cleanup will be started after all replication
// requests are completed, so no running cache IO operations happen.
queue := datastore.NewReplicationEventQueueInterceptor(datastore.NewPostgresReplicationEventQueue(testdb.New(t)))
+
var wg sync.WaitGroup
- queue.OnEnqueue(func(ctx context.Context, event datastore.ReplicationEvent, queue datastore.ReplicationEventQueue) (datastore.ReplicationEvent, error) {
- wg.Add(1)
- return queue.Enqueue(ctx, event)
- })
- queue.OnAcknowledge(func(ctx context.Context, state datastore.JobState, eventIDs []uint64, queue datastore.ReplicationEventQueue) ([]uint64, error) {
- acknowledged, err := queue.Acknowledge(ctx, state, eventIDs)
- wg.Add(-len(eventIDs))
- return acknowledged, err
- })
+ if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
+ // When maintenance operation routing is enabled we don't expect to see any
+ // replication events. The observed behaviour should still be the same though: we
+ // expect to observe the RPC calls on both the primary and secondary node because we
+ // route them to both at the same time.
+ queue.OnEnqueue(func(ctx context.Context, event datastore.ReplicationEvent, queue datastore.ReplicationEventQueue) (datastore.ReplicationEvent, error) {
+ require.FailNow(t, "no replication jobs should have been created")
+ return datastore.ReplicationEvent{}, fmt.Errorf("unexpected enqueue")
+ })
+ } else {
+ queue.OnEnqueue(func(ctx context.Context, event datastore.ReplicationEvent, queue datastore.ReplicationEventQueue) (datastore.ReplicationEvent, error) {
+ wg.Add(1)
+ return queue.Enqueue(ctx, event)
+ })
+ queue.OnAcknowledge(func(ctx context.Context, state datastore.JobState, eventIDs []uint64, queue datastore.ReplicationEventQueue) ([]uint64, error) {
+ acknowledged, err := queue.Acknowledge(ctx, state, eventIDs)
+ wg.Add(-len(eventIDs))
+ return acknowledged, err
+ })
+ }
+
logEntry := testhelper.NewDiscardingLogEntry(t)
nodeMgr, err := nodes.NewManager(logEntry, conf, nil, nil, promtest.NewMockHistogramVec(), protoregistry.GitalyProtoPreregistered, nil, nil, nil)
@@ -362,7 +380,7 @@ func TestReplicator_PropagateReplicationJob(t *testing.T) {
prf := NewGRPCServer(conf, logEntry, protoregistry.GitalyProtoPreregistered, coordinator.StreamDirector, txMgr, rs, nil, nil, nil, nil)
listener, port := listenAvailPort(t)
- ctx, cancel := context.WithCancel(testhelper.Context(t))
+ ctx, cancel := context.WithCancel(ctx)
go prf.Serve(listener)
defer prf.Stop()
diff --git a/proto/go/gitalypb/ref.pb.go b/proto/go/gitalypb/ref.pb.go
index e2a4e4b97..116e1ac18 100644
--- a/proto/go/gitalypb/ref.pb.go
+++ b/proto/go/gitalypb/ref.pb.go
@@ -3255,7 +3255,7 @@ var file_ref_proto_rawDesc = []byte{
0x17, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x66,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c,
0x79, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x12, 0x47, 0x0a,
+ 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x03, 0x12, 0x47, 0x0a,
0x08, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x66, 0x73, 0x12, 0x17, 0x2e, 0x67, 0x69, 0x74, 0x61,
0x6c, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x4c, 0x69, 0x73, 0x74,
diff --git a/proto/go/gitalypb/repository-service.pb.go b/proto/go/gitalypb/repository-service.pb.go
index 4e346ae7e..54e49033c 100644
--- a/proto/go/gitalypb/repository-service.pb.go
+++ b/proto/go/gitalypb/repository-service.pb.go
@@ -5057,28 +5057,28 @@ var file_repository_service_proto_rawDesc = []byte{
0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65,
0x70, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02,
- 0x08, 0x01, 0x12, 0x4e, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x61, 0x63, 0x6b, 0x46, 0x75, 0x6c, 0x6c,
+ 0x08, 0x03, 0x12, 0x4e, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x61, 0x63, 0x6b, 0x46, 0x75, 0x6c, 0x6c,
0x12, 0x19, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x61, 0x63, 0x6b,
0x46, 0x75, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x69,
0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x61, 0x63, 0x6b, 0x46, 0x75, 0x6c, 0x6c, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02,
- 0x08, 0x01, 0x12, 0x4e, 0x0a, 0x0a, 0x4d, 0x69, 0x64, 0x78, 0x52, 0x65, 0x70, 0x61, 0x63, 0x6b,
+ 0x08, 0x03, 0x12, 0x4e, 0x0a, 0x0a, 0x4d, 0x69, 0x64, 0x78, 0x52, 0x65, 0x70, 0x61, 0x63, 0x6b,
0x12, 0x19, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x4d, 0x69, 0x64, 0x78, 0x52, 0x65,
0x70, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x69,
0x74, 0x61, 0x6c, 0x79, 0x2e, 0x4d, 0x69, 0x64, 0x78, 0x52, 0x65, 0x70, 0x61, 0x63, 0x6b, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02,
- 0x08, 0x01, 0x12, 0x5a, 0x0a, 0x0e, 0x47, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6c,
+ 0x08, 0x03, 0x12, 0x5a, 0x0a, 0x0e, 0x47, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6c,
0x6c, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x47, 0x61,
0x72, 0x62, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x47, 0x61, 0x72,
0x62, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x12, 0x60,
+ 0x6e, 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x03, 0x12, 0x60,
0x0a, 0x10, 0x57, 0x72, 0x69, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x47, 0x72, 0x61,
0x70, 0x68, 0x12, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x57, 0x72, 0x69, 0x74,
0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x57, 0x72, 0x69,
0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x52, 0x65, 0x73,
- 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x03,
0x12, 0x57, 0x0a, 0x0e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x69,
0x7a, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f,
0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
@@ -5196,7 +5196,7 @@ var file_repository_service_proto_rawDesc = []byte{
0x70, 0x12, 0x16, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x6e,
0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x69, 0x74, 0x61,
0x6c, 0x79, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x12, 0x50, 0x0a,
+ 0x73, 0x65, 0x22, 0x09, 0x88, 0x02, 0x01, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x03, 0x12, 0x50, 0x0a,
0x0b, 0x47, 0x65, 0x74, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x1a, 0x2e, 0x67,
0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c,
@@ -5273,14 +5273,14 @@ var file_repository_service_proto_rawDesc = []byte{
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79,
0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6d, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74,
0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28,
- 0x02, 0x08, 0x01, 0x12, 0x72, 0x0a, 0x17, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x55, 0x6e, 0x72, 0x65,
+ 0x02, 0x08, 0x03, 0x12, 0x72, 0x0a, 0x17, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x55, 0x6e, 0x72, 0x65,
0x61, 0x63, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x26,
0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x55, 0x6e, 0x72,
0x65, 0x61, 0x63, 0x68, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e,
0x50, 0x72, 0x75, 0x6e, 0x65, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x63, 0x68, 0x61, 0x62, 0x6c, 0x65,
0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
- 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x12, 0x4e, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x46, 0x75,
+ 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x03, 0x12, 0x4e, 0x0a, 0x0b, 0x53, 0x65, 0x74, 0x46, 0x75,
0x6c, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1a, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e,
0x53, 0x65, 0x74, 0x46, 0x75, 0x6c, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x53, 0x65, 0x74, 0x46,
diff --git a/proto/ref.proto b/proto/ref.proto
index 21cdfa9dd..72eb62c35 100644
--- a/proto/ref.proto
+++ b/proto/ref.proto
@@ -102,7 +102,7 @@ service RefService {
rpc PackRefs(PackRefsRequest) returns (PackRefsResponse) {
option deprecated = true;
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
diff --git a/proto/repository-service.proto b/proto/repository-service.proto
index bb8660ceb..3fda65d1c 100644
--- a/proto/repository-service.proto
+++ b/proto/repository-service.proto
@@ -18,7 +18,7 @@ service RepositoryService {
rpc RepackIncremental(RepackIncrementalRequest) returns (RepackIncrementalResponse) {
option deprecated = true;
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
@@ -26,7 +26,7 @@ service RepositoryService {
rpc RepackFull(RepackFullRequest) returns (RepackFullResponse) {
option deprecated = true;
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
@@ -34,7 +34,7 @@ service RepositoryService {
rpc MidxRepack(MidxRepackRequest) returns (MidxRepackResponse) {
option deprecated = true;
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
@@ -42,7 +42,7 @@ service RepositoryService {
rpc GarbageCollect(GarbageCollectRequest) returns (GarbageCollectResponse) {
option deprecated = true;
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
@@ -50,7 +50,7 @@ service RepositoryService {
rpc WriteCommitGraph(WriteCommitGraphRequest) returns (WriteCommitGraphResponse) {
option deprecated = true;
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
@@ -180,7 +180,7 @@ service RepositoryService {
rpc Cleanup(CleanupRequest) returns (CleanupResponse) {
option deprecated = true;
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
@@ -251,7 +251,7 @@ service RepositoryService {
// Gitaly has complete control of the on-disk state of repositories.
rpc OptimizeRepository(OptimizeRepositoryRequest) returns (OptimizeRepositoryResponse) {
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}
@@ -268,7 +268,7 @@ service RepositoryService {
// wait 30 minutes, and then call PruneUnreachableObjects.
rpc PruneUnreachableObjects(PruneUnreachableObjectsRequest) returns (PruneUnreachableObjectsResponse) {
option (op_type) = {
- op: MUTATOR
+ op: MAINTENANCE
};
}