Commit 02755cd5 authored by Patrick Steinhardt's avatar Patrick Steinhardt

Remove flag guarding batched computation of changes size

In f73f0c7b (git_access: Use batched new blobs check, 2021-06-21), a
new feature flag had been added to enable batched computation of changes
size in Git authentication checks. With this feature flag enabled, Git
access checks compute all new blobs with a single RPC call instead of
doing one call per changed reference. Given that these RPCs are rather
expensive, this feature flag improves performance when multiple changes
are checked in a context where no quarantine directories are available.

This feature flag has been tested in production since June 22nd, but
couldn't yet be default-enabled because the RPC it relies on has only
been released with v14.1. Given that the feature has been tested for
such a long time now, let's remove its feature flag altogether.

Changelog: performance
parent f095fc89
---
name: git_access_batched_changes_size
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64503
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334130
milestone: '14.1'
type: development
group: group::gitaly
default_enabled: false
......@@ -498,21 +498,10 @@ module Gitlab
end
def check_changes_size
changes_size =
if Feature.enabled?(:git_access_batched_changes_size, project, default_enabled: :yaml)
revs = ['--not', '--all', '--not']
revs += changes_list.map { |change| change[:newrev] }
revs = ['--not', '--all', '--not']
revs += changes_list.map { |change| change[:newrev] }
repository.blobs(revs).sum(&:size)
else
changes_size = 0
changes_list.each do |change|
changes_size += repository.new_blobs(change[:newrev]).sum(&:size)
end
changes_size
end
changes_size = repository.blobs(revs).sum(&:size)
check_size_against_limit(changes_size)
end
......
......@@ -382,12 +382,11 @@ RSpec.describe Gitlab::GitAccessSnippet do
it_behaves_like 'a push to repository to make it over the limit'
end
shared_examples_for 'a change with GIT_OBJECT_DIRECTORY_RELATIVE env var unset' do
context 'a change with GIT_OBJECT_DIRECTORY_RELATIVE env var unset' do
let(:change_size) { 200 }
before do
stub_feature_flags(git_access_batched_changes_size: batched)
allow(snippet.repository).to receive(expected_call).and_return(
allow(snippet.repository).to receive(:blobs).and_return(
[double(:blob, size: change_size)]
)
end
......@@ -396,20 +395,6 @@ RSpec.describe Gitlab::GitAccessSnippet do
it_behaves_like 'a push to repository below the limit'
it_behaves_like 'a push to repository to make it over the limit'
end
context 'when batched computation is enabled' do
let(:batched) { true }
let(:expected_call) { :blobs }
it_behaves_like 'a change with GIT_OBJECT_DIRECTORY_RELATIVE env var unset'
end
context 'when batched computation is disabled' do
let(:batched) { false }
let(:expected_call) { :new_blobs }
it_behaves_like 'a change with GIT_OBJECT_DIRECTORY_RELATIVE env var unset'
end
end
describe 'HEAD realignment' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment