From 431a3c4a869e35d235e40b46ae4c5b031efa0385 Mon Sep 17 00:00:00 2001 From: John Cai Date: Thu, 25 Jul 2024 13:12:56 -0400 Subject: [PATCH 1/4] service: Turn InProgressTracker into an interface In order to mock these out more easily in tests, let's make InProgressTracker an interface. --- internal/gitaly/service/dependencies.go | 4 ++-- .../gitaly/service/in_progress_tracker.go | 20 ++++++++++++------- .../service/in_progress_tracker_test.go | 6 +++--- internal/gitaly/service/smarthttp/server.go | 2 +- internal/testhelper/testserver/gitaly.go | 4 ++-- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/internal/gitaly/service/dependencies.go b/internal/gitaly/service/dependencies.go index 73f45e525b..cbdbb40372 100644 --- a/internal/gitaly/service/dependencies.go +++ b/internal/gitaly/service/dependencies.go @@ -48,7 +48,7 @@ type Dependencies struct { BackupLocator backup.Locator BundleURISink *bundleuri.Sink ProcReceiveRegistry *gitalyhook.ProcReceiveRegistry - InProgressTracker *InProgressTracker + InProgressTracker InProgressTracker } // GetLogger returns the logger. @@ -167,6 +167,6 @@ func (dc *Dependencies) GetProcReceiveRegistry() *gitalyhook.ProcReceiveRegistry } // GetInProgressTracker returns the ProcReceiveRegistry. -func (dc *Dependencies) GetInProgressTracker() *InProgressTracker { +func (dc *Dependencies) GetInProgressTracker() InProgressTracker { return dc.InProgressTracker } diff --git a/internal/gitaly/service/in_progress_tracker.go b/internal/gitaly/service/in_progress_tracker.go index bd1aa7052e..c92777037a 100644 --- a/internal/gitaly/service/in_progress_tracker.go +++ b/internal/gitaly/service/in_progress_tracker.go @@ -5,20 +5,26 @@ import ( ) // InProgressTracker can be used to keep track of processes that are in flight -type InProgressTracker struct { +type InProgressTracker interface { + GetInProgress(key string) int + IncrementInProgress(key string) + DecrementInProgress(key string) +} + +type inProgressTracker struct { inProgress map[string]int l sync.RWMutex } -// NewInProgressTracker instantiates a new InProgressTracker. -func NewInProgressTracker() *InProgressTracker { - return &InProgressTracker{ +// NewInProgressTracker instantiates a new inProgressTracker. +func NewInProgressTracker() *inProgressTracker { + return &inProgressTracker{ inProgress: make(map[string]int), } } // GetInProgress gets the number of inflight processes for a given key. -func (p *InProgressTracker) GetInProgress(key string) int { +func (p *inProgressTracker) GetInProgress(key string) int { p.l.RLock() defer p.l.RUnlock() @@ -26,7 +32,7 @@ func (p *InProgressTracker) GetInProgress(key string) int { } // IncrementInProgress increments the number of inflight processes for a given key. -func (p *InProgressTracker) IncrementInProgress(key string) { +func (p *inProgressTracker) IncrementInProgress(key string) { p.l.Lock() defer p.l.Unlock() @@ -34,7 +40,7 @@ func (p *InProgressTracker) IncrementInProgress(key string) { } // DecrementInProgress decrements the number of inflight processes for a given key. -func (p *InProgressTracker) DecrementInProgress(key string) { +func (p *inProgressTracker) DecrementInProgress(key string) { p.l.Lock() defer p.l.Unlock() diff --git a/internal/gitaly/service/in_progress_tracker_test.go b/internal/gitaly/service/in_progress_tracker_test.go index 99178863c6..febef39f5c 100644 --- a/internal/gitaly/service/in_progress_tracker_test.go +++ b/internal/gitaly/service/in_progress_tracker_test.go @@ -14,12 +14,12 @@ func TestInProgressTracker(t *testing.T) { testCases := []struct { desc string expectedInProgress int - actions func(*service.InProgressTracker) + actions func(service.InProgressTracker) }{ { desc: "one in flight", expectedInProgress: 1, - actions: func(t *service.InProgressTracker) { + actions: func(t service.InProgressTracker) { t.IncrementInProgress(key) t.IncrementInProgress(key) t.DecrementInProgress(key) @@ -28,7 +28,7 @@ func TestInProgressTracker(t *testing.T) { { desc: "two in flight with concurrent writes", expectedInProgress: 2, - actions: func(t *service.InProgressTracker) { + actions: func(t service.InProgressTracker) { var wg sync.WaitGroup wg.Add(4) diff --git a/internal/gitaly/service/smarthttp/server.go b/internal/gitaly/service/smarthttp/server.go index ffd455aa27..fcc50ecccf 100644 --- a/internal/gitaly/service/smarthttp/server.go +++ b/internal/gitaly/service/smarthttp/server.go @@ -34,7 +34,7 @@ type server struct { backupLocator backup.Locator backupSink backup.Sink bundleURISink *bundleuri.Sink - inflightTracker *service.InProgressTracker + inflightTracker service.InProgressTracker generateBundles bool partitionMgr *storagemgr.PartitionManager transactionRegistry *storagemgr.TransactionRegistry diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go index 1f55f1bc3e..897c8798e4 100644 --- a/internal/testhelper/testserver/gitaly.go +++ b/internal/testhelper/testserver/gitaly.go @@ -291,7 +291,7 @@ type gitalyServerDeps struct { transactionRegistry *storagemgr.TransactionRegistry procReceiveRegistry *hook.ProcReceiveRegistry partitionManager *storagemgr.PartitionManager - inProgressTracker *service.InProgressTracker + inProgressTracker service.InProgressTracker } func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *service.Dependencies { @@ -578,7 +578,7 @@ func WithBundleURISink(sink *bundleuri.Sink) GitalyServerOpt { } // WithInProgressTracker sets the bundleuri.Sink that will be used for Gitaly services -func WithInProgressTracker(tracker *service.InProgressTracker) GitalyServerOpt { +func WithInProgressTracker(tracker service.InProgressTracker) GitalyServerOpt { return func(deps gitalyServerDeps) gitalyServerDeps { deps.inProgressTracker = tracker return deps -- GitLab From 3a4b5f970c4da11ef04ff22caa5375f6b99953a9 Mon Sep 17 00:00:00 2001 From: John Cai Date: Thu, 25 Jul 2024 13:27:28 -0400 Subject: [PATCH 2/4] smarhttp: Refactor tests to use mock InProgressTracker Decouple the tests from implementation to not rely on defining the key that will be used by the InProgressTracker but instead use a mock tracker that we can force to return the threshold needed to trigger bundle generation. --- .../service/smarthttp/upload_pack_test.go | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/internal/gitaly/service/smarthttp/upload_pack_test.go b/internal/gitaly/service/smarthttp/upload_pack_test.go index 8c91384c5f..3cfd34b517 100644 --- a/internal/gitaly/service/smarthttp/upload_pack_test.go +++ b/internal/gitaly/service/smarthttp/upload_pack_test.go @@ -26,7 +26,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v16/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/v16/internal/git/pktline" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/service" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/keyvalue" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/storagemgr" @@ -506,6 +505,26 @@ func TestServer_PostUploadPackWithBundleURI(t *testing.T) { } } +type testInProgressTracker struct { + thresholdReached bool +} + +func (t *testInProgressTracker) GetInProgress(key string) int { + if t.thresholdReached { + return concurrentUploadPackThreshold + 1 + } + + return 0 +} + +func (t *testInProgressTracker) IncrementInProgress(key string) { + return +} + +func (t *testInProgressTracker) DecrementInProgress(key string) { + return +} + func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { t.Parallel() @@ -528,7 +547,7 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { ctx context.Context, cfg config.Cfg, sink *bundleuri.Sink, - tracker *service.InProgressTracker, + tracker *testInProgressTracker, repoProto *gitalypb.Repository, repoPath string, ) @@ -542,7 +561,7 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { ctx context.Context, cfg config.Cfg, sink *bundleuri.Sink, - tracker *service.InProgressTracker, + tracker *testInProgressTracker, repoProto *gitalypb.Repository, repoPath string, ) { @@ -550,13 +569,7 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { gittest.WithTreeEntries(gittest.TreeEntry{Mode: "100644", Path: "README", Content: "much"}), gittest.WithBranch("main")) - key := repoProto.GetGlRepository() - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) + tracker.thresholdReached = true }, expectBundleGenerated: true, verifyBundle: func(t *testing.T, cfg config.Cfg, bundlePath string, commit git.ObjectID) { @@ -575,20 +588,14 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { ctx context.Context, cfg config.Cfg, sink *bundleuri.Sink, - tracker *service.InProgressTracker, + tracker *testInProgressTracker, repoProto *gitalypb.Repository, repoPath string, ) { gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(gittest.TreeEntry{Mode: "100644", Path: "README", Content: "much"}), gittest.WithBranch("main")) - key := repoProto.GetGlRepository() - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) - tracker.IncrementInProgress(key) + tracker.thresholdReached = true repo := localrepo.NewTestRepo(t, cfg, repoProto) require.NoError(t, sink.Generate(ctx, repo)) @@ -610,10 +617,12 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { ctx context.Context, cfg config.Cfg, sink *bundleuri.Sink, - tracker *service.InProgressTracker, + tracker *testInProgressTracker, repoProto *gitalypb.Repository, repoPath string, ) { + + tracker.thresholdReached = false gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(gittest.TreeEntry{Mode: "100644", Path: "README", Content: "much"}), gittest.WithBranch("main")) @@ -644,7 +653,7 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { errChan <- err } - tracker := service.NewInProgressTracker() + tracker := &testInProgressTracker{} sinkDir := t.TempDir() sink, err := bundleuri.NewSink(ctx, "file://"+sinkDir, bundleuri.WithBundleGenerationNotifier(bundleGeneratedNotifier)) -- GitLab From 5ac2bed9bd933996825f514c70457d1ea7a6163f Mon Sep 17 00:00:00 2001 From: John Cai Date: Wed, 24 Jul 2024 13:37:26 -0400 Subject: [PATCH 3/4] bundleuri: Fix face condition in GenerateOneAtATime The map that detected if an existing bundle is being generated for a given key had a race condition. Change the map so that it uses struct{} as values instead of mutexes, and protect the whole map with a single mutex. --- internal/bundleuri/sink.go | 60 ++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/internal/bundleuri/sink.go b/internal/bundleuri/sink.go index e6beabe5e7..97723112ed 100644 --- a/internal/bundleuri/sink.go +++ b/internal/bundleuri/sink.go @@ -41,8 +41,9 @@ var ( // Sink is a wrapper around the storage bucket used for accessing/writing // bundleuri bundles. type Sink struct { - bucket *blob.Bucket - bundleCreationMutex map[string]*sync.Mutex + bucket *blob.Bucket + bundleCreationInProgress map[string]struct{} + bundleCreationMutex sync.Mutex config sinkConfig } @@ -71,8 +72,8 @@ func NewSink(ctx context.Context, uri string, options ...SinkOption) (*Sink, err } s := &Sink{ - bucket: bucket, - bundleCreationMutex: make(map[string]*sync.Mutex), + bucket: bucket, + bundleCreationInProgress: make(map[string]struct{}), } var c sinkConfig @@ -119,40 +120,43 @@ func (s *Sink) getWriter(ctx context.Context, relativePath string) (io.WriteClos func (s *Sink) GenerateOneAtATime(ctx context.Context, repo *localrepo.Repo) error { bundlePath := s.relativePath(repo, defaultBundle) - var m *sync.Mutex - var ok bool + s.bundleCreationMutex.Lock() + _, ok := s.bundleCreationInProgress[bundlePath] - if m, ok = s.bundleCreationMutex[bundlePath]; !ok { - s.bundleCreationMutex[bundlePath] = &sync.Mutex{} - m = s.bundleCreationMutex[bundlePath] + if ok { + s.bundleCreationMutex.Unlock() + return fmt.Errorf("%w: %s", ErrBundleGenerationInProgress, bundlePath) } - if m.TryLock() { - defer m.Unlock() - errChan := make(chan error) - - go func(ctx context.Context) { - select { - case errChan <- s.Generate(ctx, repo): - case <-ctx.Done(): - errChan <- ctx.Err() - } - }(ctx) + s.bundleCreationInProgress[bundlePath] = struct{}{} + s.bundleCreationMutex.Unlock() + defer func() { + s.bundleCreationMutex.Lock() + delete(s.bundleCreationInProgress, bundlePath) + s.bundleCreationMutex.Unlock() + }() - err := <-errChan + errChan := make(chan error) - if s.config.notifyBundleGeneration != nil { - s.config.notifyBundleGeneration(bundlePath, err) + go func(ctx context.Context) { + select { + case errChan <- s.Generate(ctx, repo): + case <-ctx.Done(): + errChan <- ctx.Err() } - } else { - return fmt.Errorf("%w: %s", ErrBundleGenerationInProgress, bundlePath) + }(ctx) + + err := <-errChan + + if s.config.notifyBundleGeneration != nil { + s.config.notifyBundleGeneration(bundlePath, err) } return nil } // Generate creates a bundle for bundle-URI use into the bucket. -func (s Sink) Generate(ctx context.Context, repo *localrepo.Repo) (returnErr error) { +func (s *Sink) Generate(ctx context.Context, repo *localrepo.Repo) (returnErr error) { ref, err := repo.HeadReference(ctx) if err != nil { return fmt.Errorf("resolve HEAD ref: %w", err) @@ -195,7 +199,7 @@ func (s Sink) Generate(ctx context.Context, repo *localrepo.Repo) (returnErr err } // SignedURL returns a public URL to give anyone access to download the bundle from. -func (s Sink) SignedURL(ctx context.Context, repo storage.Repository) (string, error) { +func (s *Sink) SignedURL(ctx context.Context, repo storage.Repository) (string, error) { relativePath := s.relativePath(repo, defaultBundle) repoProto, ok := repo.(*gitalypb.Repository) @@ -212,7 +216,7 @@ func (s Sink) SignedURL(ctx context.Context, repo storage.Repository) (string, e if err == nil { return "", ErrBundleNotFound } - return "", fmt.Errorf("%w: %w", ErrBundleNotFound, err) + return "", fmt.Errorf("checking bundle existence: %w", err) } uri, err := s.bucket.SignedURL(ctx, relativePath, &blob.SignedURLOptions{ -- GitLab From 339e12f78cf83ebca9dcc482fc2ffa558aa1ac16 Mon Sep 17 00:00:00 2001 From: John Cai Date: Wed, 24 Jul 2024 13:08:02 -0400 Subject: [PATCH 4/4] smarthttp: Fixes to upload_pack Various fixes to the bundle generation code in PostUploadPackWithSidechannel including: - not setting partition manager explicitly - cleaning up error handling - handle the case when partition manager is not set --- .../gitaly/service/smarthttp/upload_pack.go | 90 +++++++++++-------- .../service/smarthttp/upload_pack_test.go | 35 +------- internal/testhelper/testserver/gitaly.go | 8 -- 3 files changed, 53 insertions(+), 80 deletions(-) diff --git a/internal/gitaly/service/smarthttp/upload_pack.go b/internal/gitaly/service/smarthttp/upload_pack.go index f8dc4260c3..1b773079bd 100644 --- a/internal/gitaly/service/smarthttp/upload_pack.go +++ b/internal/gitaly/service/smarthttp/upload_pack.go @@ -16,7 +16,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v16/internal/git" "gitlab.com/gitlab-org/gitaly/v16/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/v16/internal/git/stats" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/storagectx" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/storagemgr" "gitlab.com/gitlab-org/gitaly/v16/internal/grpc/sidechannel" @@ -130,21 +129,13 @@ func (s *server) runUploadPack(ctx context.Context, req *gitalypb.PostUploadPack gitConfig = append(gitConfig, bundleuri.CapabilitiesGitConfig(ctx)...) - txID := storage.ExtractTransactionID(ctx) + originalRepo := req.GetRepository() - var originalRepo *gitalypb.Repository + storagectx.RunWithTransaction(ctx, func(tx storagectx.Transaction) { + originalRepo = tx.OriginalRepository(req.GetRepository()) + }) - if txID != 0 { - currentTx, err := s.transactionRegistry.Get(txID) - if err != nil { - return nil, structerr.NewInternal("error getting transaction: %w", err) - } - originalRepo = currentTx.OriginalRepository(req.GetRepository()) - } else { - originalRepo = req.GetRepository() - } - - key := originalRepo.GetGlRepository() + key := originalRepo.GetStorageName() + ":" + originalRepo.GetRelativePath() uploadPackConfig, err := bundleuri.UploadPackGitConfig(ctx, s.bundleURISink, req.GetRepository()) if err != nil { @@ -157,36 +148,57 @@ func (s *server) runUploadPack(ctx context.Context, req *gitalypb.PostUploadPack ctx, cancel := context.WithTimeout(context.Background(), bundleGenerationTimeout) defer cancel() - tx, err := s.partitionMgr.Begin( - ctx, - originalRepo.GetStorageName(), - 0, - storagemgr.TransactionOptions{ - ReadOnly: true, - RelativePath: originalRepo.GetRelativePath(), - }, - ) - if err != nil { - ctxlogrus.Extract(ctx).WithError(err).Error("failed starting transaction") - } + if s.partitionMgr != nil { + tx, err := s.partitionMgr.Begin( + ctx, + originalRepo.GetStorageName(), + 0, + storagemgr.TransactionOptions{ + ReadOnly: true, + RelativePath: originalRepo.GetRelativePath(), + }, + ) + if err != nil { + ctxlogrus.Extract(ctx).WithError(err).Error("failed starting transaction") + return + } - ctx = storagectx.ContextWithTransaction(ctx, tx) + ctx = storagectx.ContextWithTransaction(ctx, tx) + + if err := s.bundleURISink.GenerateOneAtATime(ctx, localrepo.New( + s.logger, + s.locator, + s.gitCmdFactory, + s.catfileCache, + originalRepo)); err != nil { + ctxlogrus.Extract(ctx).WithError(err).Error("generate bundle") + if tx == nil { + return + } + + if err := tx.Rollback(); err != nil { + ctxlogrus.Extract(ctx).WithError(err).Error("failed rolling back transaction") + return + } + + return + } - if err := s.bundleURISink.GenerateOneAtATime(ctx, localrepo.New( - s.logger, - s.locator, - s.gitCmdFactory, - s.catfileCache, - originalRepo)); err != nil { - ctxlogrus.Extract(ctx).WithError(err).Error("generate bundle") - if err := tx.Rollback(); err != nil && !errors.Is(err, storagemgr.ErrTransactionAlreadyCommitted) { + if err := tx.Commit(ctx); err != nil { + ctxlogrus.Extract(ctx).WithError(err).Error("committing transaction") + } + } else { + if err := s.bundleURISink.GenerateOneAtATime(ctx, localrepo.New( + s.logger, + s.locator, + s.gitCmdFactory, + s.catfileCache, + originalRepo)); err != nil { + ctxlogrus.Extract(ctx).WithError(err).Error("generate bundle") ctxlogrus.Extract(ctx).WithError(err).Error("failed rolling back transaction") + return } } - - if err := tx.Commit(ctx); err != nil && !errors.Is(err, storagemgr.ErrTransactionAlreadyCommitted) { - ctxlogrus.Extract(ctx).WithError(err).Error("committing transaction") - } }() } else if !errors.Is(err, bundleuri.ErrSinkMissing) { log.AddFields(ctx, log.Fields{"bundle_uri_error": err}) diff --git a/internal/gitaly/service/smarthttp/upload_pack_test.go b/internal/gitaly/service/smarthttp/upload_pack_test.go index 3cfd34b517..fc53b79924 100644 --- a/internal/gitaly/service/smarthttp/upload_pack_test.go +++ b/internal/gitaly/service/smarthttp/upload_pack_test.go @@ -27,10 +27,8 @@ import ( "gitlab.com/gitlab-org/gitaly/v16/internal/git/pktline" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/keyvalue" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage/storagemgr" "gitlab.com/gitlab-org/gitaly/v16/internal/grpc/sidechannel" - "gitlab.com/gitlab-org/gitaly/v16/internal/helper" "gitlab.com/gitlab-org/gitaly/v16/internal/structerr" "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v16/internal/testhelper/testcfg" @@ -517,13 +515,9 @@ func (t *testInProgressTracker) GetInProgress(key string) int { return 0 } -func (t *testInProgressTracker) IncrementInProgress(key string) { - return -} +func (t *testInProgressTracker) IncrementInProgress(key string) {} -func (t *testInProgressTracker) DecrementInProgress(key string) { - return -} +func (t *testInProgressTracker) DecrementInProgress(key string) {} func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { t.Parallel() @@ -621,7 +615,6 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { repoProto *gitalypb.Repository, repoPath string, ) { - tracker.thresholdReached = false gittest.WriteCommit(t, cfg, repoPath, gittest.WithTreeEntries(gittest.TreeEntry{Mode: "100644", Path: "README", Content: "much"}), @@ -665,38 +658,14 @@ func TestServer_PostUploadPackAutogenerateBundles(t *testing.T) { cfg.BundleURI.Autogeneration = true gitCmdFactory := gittest.NewCommandFactory(t, cfg) - locator := config.NewLocator(cfg) catfileCache := catfile.NewCache(cfg) t.Cleanup(catfileCache.Stop) - dbMgr, err := keyvalue.NewDBManager( - cfg.Storages, - keyvalue.NewBadgerStore, - helper.NewNullTickerFactory(), - logger, - ) - require.NoError(t, err) - t.Cleanup(dbMgr.Close) - - partitionManager, err := storagemgr.NewPartitionManager( - ctx, - cfg.Storages, - gitCmdFactory, - localrepo.NewFactory(logger, locator, gitCmdFactory, catfileCache), - logger, - dbMgr, - cfg.Prometheus, - nil, - ) - require.NoError(t, err) - t.Cleanup(partitionManager.Close) - server := startSmartHTTPServerWithOptions(t, cfg, nil, []testserver.GitalyServerOpt{ testserver.WithBundleURISink(sink), testserver.WithLogger(logger), testserver.WithInProgressTracker(tracker), testserver.WithTransactionRegistry(storagemgr.NewTransactionRegistry()), - testserver.WithPartitionManager(partitionManager), testserver.WithGitCommandFactory(gitCmdFactory), }) diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go index 897c8798e4..c8b50b0e51 100644 --- a/internal/testhelper/testserver/gitaly.go +++ b/internal/testhelper/testserver/gitaly.go @@ -609,11 +609,3 @@ func WithProcReceiveRegistry(registry *hook.ProcReceiveRegistry) GitalyServerOpt return deps } } - -// WithPartitionManager sets the proc receive registry that will be used for Gitaly services. -func WithPartitionManager(partitionMgr *storagemgr.PartitionManager) GitalyServerOpt { - return func(deps gitalyServerDeps) gitalyServerDeps { - deps.partitionManager = partitionMgr - return deps - } -} -- GitLab