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:
authorJohn Cai <jcai@gitlab.com>2022-04-20 19:31:17 +0300
committerJohn Cai <jcai@gitlab.com>2022-04-21 03:18:34 +0300
commit6f96233eb33adefc756f4be6906a6370ec84a8bd (patch)
tree58223216973e31c266fba8d086bd1de2c7232e16
parent53768dae0bc6395d2b80438286723a912aa50921 (diff)
Remove Maintenance routing feature flag
Since the maintenance routing feature flag has been running in production without issue, we can now remove it. Changelog: changed
-rw-r--r--internal/gitaly/service/ref/pack_refs_test.go21
-rw-r--r--internal/gitaly/service/repository/cleanup_test.go31
-rw-r--r--internal/gitaly/service/repository/commit_graph_test.go26
-rw-r--r--internal/gitaly/service/repository/gc_test.go73
-rw-r--r--internal/gitaly/service/repository/midx_test.go30
-rw-r--r--internal/gitaly/service/repository/optimize_test.go21
-rw-r--r--internal/gitaly/service/repository/prune_unreachable_objects_test.go8
-rw-r--r--internal/gitaly/service/repository/repack_test.go59
-rw-r--r--internal/metadata/featureflag/ff_maintenance_operation_routing.go4
-rw-r--r--internal/praefect/coordinator.go6
-rw-r--r--internal/praefect/coordinator_test.go32
-rw-r--r--internal/praefect/replicator_test.go35
12 files changed, 54 insertions, 292 deletions
diff --git a/internal/gitaly/service/ref/pack_refs_test.go b/internal/gitaly/service/ref/pack_refs_test.go
index e6da2b733..c91db2de5 100644
--- a/internal/gitaly/service/ref/pack_refs_test.go
+++ b/internal/gitaly/service/ref/pack_refs_test.go
@@ -2,7 +2,6 @@ package ref
import (
"bufio"
- "context"
"fmt"
"os"
"path/filepath"
@@ -14,7 +13,6 @@ 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"
@@ -23,12 +21,8 @@ import (
func TestPackRefsSuccessfulRequest(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPackRefsSuccessfulRequest)
-}
-
-func testPackRefsSuccessfulRequest(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
cfg, repoProto, repoPath, client := setupRefService(ctx, t)
packedRefs := linesInPackfile(t, repoPath)
@@ -74,19 +68,10 @@ 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()
+ ctx := testhelper.Context(t)
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
@@ -109,7 +94,7 @@ func testPackRefsInvalidRequest(t *testing.T, ctx context.Context) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, cfg.Storages[0].Path),
- praefectErr,
+ `routing repository maintenance: getting repository metadata: repository not found`,
),
),
},
diff --git a/internal/gitaly/service/repository/cleanup_test.go b/internal/gitaly/service/repository/cleanup_test.go
index 50fc670ce..862ee0e5b 100644
--- a/internal/gitaly/service/repository/cleanup_test.go
+++ b/internal/gitaly/service/repository/cleanup_test.go
@@ -1,7 +1,6 @@
package repository
import (
- "context"
"fmt"
"os"
"path/filepath"
@@ -11,7 +10,6 @@ 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"
@@ -26,11 +24,8 @@ 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()
+ ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
testCases := []struct {
@@ -92,12 +87,8 @@ func testCleanupDeletesStaleWorktrees(t *testing.T, ctx context.Context) {
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")
@@ -120,11 +111,8 @@ func testCleanupDeletesOrphanedWorktrees(t *testing.T, ctx context.Context) {
// 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()
+ ctx := testhelper.Context(t)
const (
worktreeName = "test-worktree"
worktreeAdminDir = "worktrees"
@@ -165,19 +153,10 @@ func testCleanupDisconnectedWorktrees(t *testing.T, ctx context.Context) {
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
@@ -199,7 +178,7 @@ func testCleanupInvalidRequest(t *testing.T, ctx context.Context) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: %q`, filepath.Join(cfg.Storages[0].Path, "so/me/some.git")),
- praefectErr,
+ `routing repository maintenance: getting repository metadata: repository not found`,
),
),
},
diff --git a/internal/gitaly/service/repository/commit_graph_test.go b/internal/gitaly/service/repository/commit_graph_test.go
index b50f520dd..c55c64665 100644
--- a/internal/gitaly/service/repository/commit_graph_test.go
+++ b/internal/gitaly/service/repository/commit_graph_test.go
@@ -2,7 +2,6 @@ package repository
import (
"bytes"
- "context"
"fmt"
"os"
"path/filepath"
@@ -12,7 +11,6 @@ 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"
@@ -22,12 +20,8 @@ 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)
@@ -64,12 +58,8 @@ func testWriteCommitGraphWithExistingCommitGraphCreatedWithDefaults(t *testing.T
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)
@@ -106,12 +96,8 @@ func testWriteCommitGraphWithExistingCommitGraphCreatedWithSplit(t *testing.T, c
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)
@@ -174,12 +160,8 @@ 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 3308110bd..14abe909d 100644
--- a/internal/gitaly/service/repository/gc_test.go
+++ b/internal/gitaly/service/repository/gc_test.go
@@ -1,7 +1,6 @@
package repository
import (
- "context"
"fmt"
"os"
"path/filepath"
@@ -16,7 +15,6 @@ 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"
@@ -32,12 +30,8 @@ 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
@@ -51,12 +45,8 @@ func testGarbageCollectCommitGraph(t *testing.T, ctx context.Context) {
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 {
@@ -108,12 +98,8 @@ func testGarbageCollectSuccess(t *testing.T, ctx context.Context) {
func TestGarbageCollectWithPrune(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectWithPrune)
-}
-
-func testGarbageCollectWithPrune(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
cfg, repo, repoPath, client := setupRepositoryService(ctx, t)
blobHashes := gittest.WriteBlobs(t, cfg, repoPath, 3)
@@ -155,12 +141,8 @@ func testGarbageCollectWithPrune(t *testing.T, ctx context.Context) {
func TestGarbageCollectLogStatistics(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectLogStatistics)
-}
-
-func testGarbageCollectLogStatistics(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
logger, hook := test.NewNullLogger()
_, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger))
@@ -173,12 +155,8 @@ func testGarbageCollectLogStatistics(t *testing.T, ctx context.Context) {
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}
@@ -219,11 +197,8 @@ func testGarbageCollectDeletesRefsLocks(t *testing.T, ctx context.Context) {
func TestGarbageCollectDeletesPackedRefsLock(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesPackedRefsLock)
-}
-func testGarbageCollectDeletesPackedRefsLock(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
testCases := []struct {
@@ -290,12 +265,8 @@ func testGarbageCollectDeletesPackedRefsLock(t *testing.T, ctx context.Context)
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}
@@ -331,11 +302,8 @@ func testGarbageCollectDeletesFileLocks(t *testing.T, ctx context.Context) {
func TestGarbageCollectDeletesPackedRefsNew(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testGarbageCollectDeletesPackedRefsNew)
-}
-func testGarbageCollectDeletesPackedRefsNew(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
testCases := []struct {
@@ -390,20 +358,11 @@ func testGarbageCollectDeletesPackedRefsNew(t *testing.T, ctx context.Context) {
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
@@ -422,7 +381,7 @@ func testGarbageCollectFailure(t *testing.T, ctx context.Context) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/bar"`, storagePath),
- praefectErr,
+ `routing repository maintenance: getting repository metadata: repository not found`,
),
),
},
@@ -439,12 +398,8 @@ func testGarbageCollectFailure(t *testing.T, ctx context.Context) {
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
@@ -538,12 +493,8 @@ 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 d0bea2ca0..1dec37ebf 100644
--- a/internal/gitaly/service/repository/midx_test.go
+++ b/internal/gitaly/service/repository/midx_test.go
@@ -17,7 +17,6 @@ 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"
@@ -29,12 +28,8 @@ 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
@@ -52,12 +47,8 @@ func testMidxWrite(t *testing.T, ctx context.Context) {
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)
@@ -84,12 +75,8 @@ func testMidxRewrite(t *testing.T, ctx context.Context) {
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
@@ -128,12 +115,8 @@ func testMidxRepack(t *testing.T, ctx context.Context) {
func TestMidxRepack_transactional(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepackTransactional)
-}
-
-func testMidxRepackTransactional(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
txManager := transaction.NewTrackingManager()
cfg, repo, repoPath, client := setupRepositoryService(ctx, t, testserver.WithTransactionManager(txManager))
@@ -162,11 +145,8 @@ func testMidxRepackTransactional(t *testing.T, ctx context.Context) {
func TestMidxRepackExpire(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testMidxRepackExpire)
-}
-func testMidxRepackExpire(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
for _, packsAdded := range []int{3, 5, 11, 20} {
diff --git a/internal/gitaly/service/repository/optimize_test.go b/internal/gitaly/service/repository/optimize_test.go
index 4c63c3972..13f5804da 100644
--- a/internal/gitaly/service/repository/optimize_test.go
+++ b/internal/gitaly/service/repository/optimize_test.go
@@ -2,7 +2,6 @@ package repository
import (
"bytes"
- "context"
"fmt"
"os"
"path/filepath"
@@ -14,7 +13,6 @@ 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"
@@ -45,12 +43,8 @@ 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")
@@ -163,19 +157,10 @@ func testOptimizeRepository(t *testing.T, ctx context.Context) {
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
@@ -198,7 +183,7 @@ func testOptimizeRepositoryValidation(t *testing.T, ctx context.Context) {
codes.NotFound,
gitalyOrPraefect(
fmt.Sprintf(`GetRepoPath: not a git repository: "%s/path/not/exist"`, cfg.Storages[0].Path),
- praefectErr,
+ `routing repository maintenance: getting repository metadata: repository not found`,
),
),
},
diff --git a/internal/gitaly/service/repository/prune_unreachable_objects_test.go b/internal/gitaly/service/repository/prune_unreachable_objects_test.go
index b02aa224e..3c1c1d640 100644
--- a/internal/gitaly/service/repository/prune_unreachable_objects_test.go
+++ b/internal/gitaly/service/repository/prune_unreachable_objects_test.go
@@ -1,7 +1,6 @@
package repository
import (
- "context"
"os"
"path/filepath"
"testing"
@@ -11,19 +10,14 @@ 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) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testPruneUnreachableObjects)
-}
-
-func testPruneUnreachableObjects(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
setObjectTime := func(t *testing.T, repoPath string, objectID git.ObjectID, when time.Time) {
diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go
index 244e23077..4dcc1b263 100644
--- a/internal/gitaly/service/repository/repack_test.go
+++ b/internal/gitaly/service/repository/repack_test.go
@@ -1,7 +1,6 @@
package repository
import (
- "context"
"fmt"
"path/filepath"
"testing"
@@ -13,7 +12,6 @@ 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"
@@ -23,12 +21,8 @@ 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")
@@ -54,12 +48,8 @@ func testRepackIncrementalSuccess(t *testing.T, ctx context.Context) {
func TestRepackIncrementalCollectLogStatistics(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalCollectLogStatistics)
-}
-
-func testRepackIncrementalCollectLogStatistics(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
logger, hook := test.NewNullLogger()
_, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger))
@@ -72,12 +62,8 @@ func testRepackIncrementalCollectLogStatistics(t *testing.T, ctx context.Context
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"
@@ -111,20 +97,14 @@ func testRepackLocal(t *testing.T, ctx context.Context) {
require.Contains(t, string(packContents), repoCommit.String())
}
+const praefectErr = `routing repository maintenance: getting repository metadata: repository not found`
+
func TestRepackIncrementalFailure(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackIncrementalFailure)
-}
-func testRepackIncrementalFailure(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"/"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
@@ -169,11 +149,8 @@ func testRepackIncrementalFailure(t *testing.T, ctx context.Context) {
func TestRepackFullSuccess(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullSuccess)
-}
-func testRepackFullSuccess(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
cfg, client := setupRepositoryServiceWithoutRepo(t)
tests := []struct {
@@ -228,12 +205,8 @@ func testRepackFullSuccess(t *testing.T, ctx context.Context) {
func TestRepackFullCollectLogStatistics(t *testing.T) {
t.Parallel()
- testhelper.NewFeatureSets(featureflag.MaintenanceOperationRouting).Run(t, testRepackFullCollectLogStatistics)
-}
-
-func testRepackFullCollectLogStatistics(t *testing.T, ctx context.Context) {
- t.Parallel()
+ ctx := testhelper.Context(t)
logger, hook := test.NewNullLogger()
_, repo, _, client := setupRepositoryService(ctx, t, testserver.WithLogger(logger))
@@ -273,18 +246,10 @@ 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()
+ ctx := testhelper.Context(t)
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
@@ -329,12 +294,8 @@ func testRepackFullFailure(t *testing.T, ctx context.Context) {
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/metadata/featureflag/ff_maintenance_operation_routing.go b/internal/metadata/featureflag/ff_maintenance_operation_routing.go
deleted file mode 100644
index 9f108af9c..000000000
--- a/internal/metadata/featureflag/ff_maintenance_operation_routing.go
+++ /dev/null
@@ -1,4 +0,0 @@
-package featureflag
-
-// MaintenanceOperationRouting enables routing logic that is specific to maintenance operations.
-var MaintenanceOperationRouting = NewFeatureFlag("maintenance_operation_routing", false)
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go
index 7e3c4b60c..82c32fcd0 100644
--- a/internal/praefect/coordinator.go
+++ b/internal/praefect/coordinator.go
@@ -321,11 +321,7 @@ func (c *Coordinator) directRepositoryScopedMessage(ctx context.Context, call gr
case protoregistry.OpMutator:
ps, err = c.mutatorStreamParameters(ctx, call)
case protoregistry.OpMaintenance:
- if featureflag.MaintenanceOperationRouting.IsEnabled(ctx) {
- ps, err = c.maintenanceStreamParameters(ctx, call)
- } else {
- ps, err = c.mutatorStreamParameters(ctx, call)
- }
+ ps, err = c.maintenanceStreamParameters(ctx, call)
default:
err = fmt.Errorf("unknown operation type: %v", call.methodInfo.Operation)
}
diff --git a/internal/praefect/coordinator_test.go b/internal/praefect/coordinator_test.go
index fd28f29d6..3b4d53d15 100644
--- a/internal/praefect/coordinator_test.go
+++ b/internal/praefect/coordinator_test.go
@@ -495,8 +495,6 @@ func TestStreamDirector_maintenance(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
// Behaviour between the new and old routing are sufficiently different that
// it doesn't make sense to try and cram both tests in here.
- ctx := featureflag.ContextWithFeatureFlag(ctx, featureflag.MaintenanceOperationRouting, true)
-
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")
@@ -549,36 +547,6 @@ func TestStreamDirector_maintenance(t *testing.T) {
require.Equal(t, tc.expectedErr, streamParams.RequestFinalizer())
})
}
-
- t.Run("disabled maintenance routing", func(t *testing.T) {
- ctx := featureflag.ContextWithFeatureFlag(ctx, featureflag.MaintenanceOperationRouting, false)
-
- replicationEventCounter := 0
- queueInterceptor.OnEnqueue(func(context.Context, datastore.ReplicationEvent, datastore.ReplicationEventQueue) (datastore.ReplicationEvent, error) {
- replicationEventCounter++
- return datastore.ReplicationEvent{}, nil
- })
-
- streamParams, err := coordinator.StreamDirector(ctx, methodInfo.FullMethodName(), &mockPeeker{message})
- require.NoError(t, err)
-
- // We're cheating a bit: the method we use here is not something that the
- // coordinator would know, and thus it wouldn't ever set up transactions for that
- // call either. This is accidentally the same behaviour like for any of the other
- // preexisting maintenance-style RPCs though, so it's good enough. Furthermore, we
- // really only want to ensure that the feature flag does its thing. The actual logic
- // of mutator stream parameters is tested elsewhere already.
- require.Equal(t, node1.Address, streamParams.Primary().Conn.Target())
- require.Empty(t, streamParams.Secondaries())
-
- // There shouldn't be any replication event yet.
- require.Zero(t, replicationEventCounter)
-
- require.NoError(t, streamParams.RequestFinalizer())
-
- // But there should be one after having called the request finalizer.
- require.Equal(t, 1, replicationEventCounter)
- })
}
type mockRouter struct {
diff --git a/internal/praefect/replicator_test.go b/internal/praefect/replicator_test.go
index a0dba9d70..89e5d342c 100644
--- a/internal/praefect/replicator_test.go
+++ b/internal/praefect/replicator_test.go
@@ -27,7 +27,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/transaction"
"gitlab.com/gitlab-org/gitaly/v14/internal/helper"
- "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag"
"gitlab.com/gitlab-org/gitaly/v14/internal/middleware/metadatahandler"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/config"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/datastore"
@@ -281,11 +280,9 @@ 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()
+
+ ctx := testhelper.Context(t)
primaryStorage, secondaryStorage := "internal-gitaly-0", "internal-gitaly-1"
primCfg := testcfg.Build(t, testcfg.WithStorages(primaryStorage))
@@ -322,26 +319,14 @@ func testReplicatorPropagateReplicationJob(t *testing.T, ctx context.Context) {
queue := datastore.NewReplicationEventQueueInterceptor(datastore.NewPostgresReplicationEventQueue(testdb.New(t)))
var wg sync.WaitGroup
- 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
- })
- }
+ // 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")
+ })
logEntry := testhelper.NewDiscardingLogEntry(t)