Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ee473019
Commit
ee473019
authored
Apr 06, 2022
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ci_artifact_fast_removal_large_loop_limit feature flag
Changelog: performance
parent
c7813510
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
18 deletions
+7
-18
app/services/ci/job_artifacts/destroy_all_expired_service.rb
app/services/ci/job_artifacts/destroy_all_expired_service.rb
+4
-6
config/feature_flags/development/ci_artifact_fast_removal_large_loop_limit.yml
...development/ci_artifact_fast_removal_large_loop_limit.yml
+0
-8
spec/services/ci/job_artifacts/destroy_all_expired_service_spec.rb
...ices/ci/job_artifacts/destroy_all_expired_service_spec.rb
+3
-4
No files found.
app/services/ci/job_artifacts/destroy_all_expired_service.rb
View file @
ee473019
...
@@ -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
...
...
config/feature_flags/development/ci_artifact_fast_removal_large_loop_limit.yml
deleted
100644 → 0
View file @
c7813510
---
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
spec/services/ci/job_artifacts/destroy_all_expired_service_spec.rb
View file @
ee473019
...
@@ -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
}
::L
ARGE_L
OOP_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
}
::L
ARGE_L
OOP_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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment