diff options
Diffstat (limited to 'internal/gitaly/service')
-rw-r--r-- | internal/gitaly/service/repository/repack.go | 10 | ||||
-rw-r--r-- | internal/gitaly/service/repository/repack_test.go | 22 |
2 files changed, 0 insertions, 32 deletions
diff --git a/internal/gitaly/service/repository/repack.go b/internal/gitaly/service/repository/repack.go index 18415d4ba..6ba97185d 100644 --- a/internal/gitaly/service/repository/repack.go +++ b/internal/gitaly/service/repository/repack.go @@ -3,11 +3,9 @@ package repository import ( "context" "fmt" - "math" "github.com/prometheus/client_golang/prometheus" gitalyerrors "gitlab.com/gitlab-org/gitaly/v14/internal/errors" - "gitlab.com/gitlab-org/gitaly/v14/internal/git" "gitlab.com/gitlab-org/gitaly/v14/internal/git/housekeeping" "gitlab.com/gitlab-org/gitaly/v14/internal/helper" "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb" @@ -25,14 +23,6 @@ func init() { prometheus.MustRegister(repackCounter) } -// log2Threads returns the log-2 number of threads based on the number of -// provided CPUs. This prevents repacking operations from exhausting all -// available CPUs and increasing request latency -func log2Threads(numCPUs int) git.ValueFlag { - n := math.Max(1, math.Floor(math.Log2(float64(numCPUs)))) - return git.ValueFlag{Name: "--threads", Value: fmt.Sprint(n)} -} - func (s *server) RepackFull(ctx context.Context, in *gitalypb.RepackFullRequest) (*gitalypb.RepackFullResponse, error) { if in.GetRepository() == nil { return nil, helper.ErrInvalidArgument(gitalyerrors.ErrEmptyRepository) diff --git a/internal/gitaly/service/repository/repack_test.go b/internal/gitaly/service/repository/repack_test.go index 7e73290a6..d7efb78dc 100644 --- a/internal/gitaly/service/repository/repack_test.go +++ b/internal/gitaly/service/repository/repack_test.go @@ -300,25 +300,3 @@ func TestRepackFullDeltaIslands(t *testing.T) { return err }) } - -func TestLog2Threads(t *testing.T) { - t.Parallel() - for _, tt := range []struct { - cpus int - threads string - }{ - {1, "1"}, - {2, "1"}, - {3, "1"}, - {4, "2"}, - {8, "3"}, - {9, "3"}, - {13, "3"}, - {16, "4"}, - {27, "4"}, - {32, "5"}, - } { - actualThreads := log2Threads(tt.cpus) - require.Equal(t, tt.threads, actualThreads.Value) - } -} |