Commit ee473019 authored by drew cimino's avatar drew cimino

Remove ci_artifact_fast_removal_large_loop_limit feature flag

Changelog: performance
parent c7813510
...@@ -7,16 +7,14 @@ module Ci ...@@ -7,16 +7,14 @@ module Ci
include ::Gitlab::LoopHelpers include ::Gitlab::LoopHelpers
BATCH_SIZE = 100 BATCH_SIZE = 100
LOOP_LIMIT = 500
LOOP_TIMEOUT = 5.minutes LOOP_TIMEOUT = 5.minutes
SMALL_LOOP_LIMIT = 100
LARGE_LOOP_LIMIT = 500
EXCLUSIVE_LOCK_KEY = 'expired_job_artifacts:destroy:lock'
LOCK_TIMEOUT = 6.minutes LOCK_TIMEOUT = 6.minutes
EXCLUSIVE_LOCK_KEY = 'expired_job_artifacts:destroy:lock'
def initialize def initialize
@removed_artifacts_count = 0 @removed_artifacts_count = 0
@start_at = Time.current @start_at = Time.current
@loop_limit = ::Feature.enabled?(:ci_artifact_fast_removal_large_loop_limit, default_enabled: :yaml) ? LARGE_LOOP_LIMIT : SMALL_LOOP_LIMIT
end end
## ##
...@@ -42,7 +40,7 @@ module Ci ...@@ -42,7 +40,7 @@ module Ci
private private
def destroy_unlocked_job_artifacts def destroy_unlocked_job_artifacts
loop_until(timeout: LOOP_TIMEOUT, limit: @loop_limit) do loop_until(timeout: LOOP_TIMEOUT, limit: LOOP_LIMIT) do
artifacts = Ci::JobArtifact.expired_before(@start_at).artifact_unlocked.limit(BATCH_SIZE) artifacts = Ci::JobArtifact.expired_before(@start_at).artifact_unlocked.limit(BATCH_SIZE)
service_response = destroy_batch(artifacts) service_response = destroy_batch(artifacts)
@removed_artifacts_count += service_response[:destroyed_artifacts_count] @removed_artifacts_count += service_response[:destroyed_artifacts_count]
...@@ -59,7 +57,7 @@ module Ci ...@@ -59,7 +57,7 @@ module Ci
@removed_artifacts_count += service_response[:destroyed_artifacts_count] @removed_artifacts_count += service_response[:destroyed_artifacts_count]
break if loop_timeout? break if loop_timeout?
break if index >= @loop_limit break if index >= LOOP_LIMIT
end end
end end
......
---
name: ci_artifact_fast_removal_large_loop_limit
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76504
rollout_issue_url:
milestone: '14.6'
type: development
group: group::pipeline execution
default_enabled: false
...@@ -31,7 +31,7 @@ RSpec.describe Ci::JobArtifacts::DestroyAllExpiredService, :clean_gitlab_redis_s ...@@ -31,7 +31,7 @@ RSpec.describe Ci::JobArtifacts::DestroyAllExpiredService, :clean_gitlab_redis_s
end end
before do before do
stub_const("#{described_class}::LARGE_LOOP_LIMIT", 1) stub_const("#{described_class}::LOOP_LIMIT", 1)
# This artifact-with-file is created before the control execution to ensure # This artifact-with-file is created before the control execution to ensure
# that the DeletedObject operations are accounted for in the query count. # that the DeletedObject operations are accounted for in the query count.
...@@ -130,7 +130,7 @@ RSpec.describe Ci::JobArtifacts::DestroyAllExpiredService, :clean_gitlab_redis_s ...@@ -130,7 +130,7 @@ RSpec.describe Ci::JobArtifacts::DestroyAllExpiredService, :clean_gitlab_redis_s
let!(:artifact) { create(:ci_job_artifact, :expired, job: job, locked: job.pipeline.locked) } let!(:artifact) { create(:ci_job_artifact, :expired, job: job, locked: job.pipeline.locked) }
before do before do
stub_const("#{described_class}::LARGE_LOOP_LIMIT", 10) stub_const("#{described_class}::LOOP_LIMIT", 10)
end end
context 'when the import fails' do context 'when the import fails' do
...@@ -200,8 +200,7 @@ RSpec.describe Ci::JobArtifacts::DestroyAllExpiredService, :clean_gitlab_redis_s ...@@ -200,8 +200,7 @@ RSpec.describe Ci::JobArtifacts::DestroyAllExpiredService, :clean_gitlab_redis_s
context 'when loop reached loop limit' do context 'when loop reached loop limit' do
before do before do
stub_feature_flags(ci_artifact_fast_removal_large_loop_limit: false) stub_const("#{described_class}::LOOP_LIMIT", 1)
stub_const("#{described_class}::SMALL_LOOP_LIMIT", 1)
end end
it 'destroys one artifact' do it 'destroys one artifact' 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