Use new locked column on ci_job_artifacts in DestroyAllExpiredService
What does this MR do and why?
Adds a feature flag (:ci_destroy_unlocked_job_artifacts
) which when enabled, changes DestroyAllExpiredService to using the new locked
column on ci_job_artifacts
to mark unlocked and expired artifacts for deletion.
This is intended to resolve #327281 (closed) which describes how the performance of using the locked
column on ci_pipelines
necessitating a join ci_pipelines -> ci_builds -> ci_job_artifacts
is causing us to fall significantly behind on marking artifacts for deletion, which results in us storing an estimated >800TB
of unnecessary objects.
This MR will only cover marking job artifacts for deletion if they are unlocked, expired, and were created after !70235 (merged) was merged. This is expected, because the intent is to stop the problem from growing worse, and the follow up issue to clean up old job artifacts is intended to be addressed in #322817 (closed).
Feature Flag
ci_destroy_unlocked_job_artifacts
: #338165 (closed)
Database
Query (https://console.postgres.ai/shared/b0ef3b07-89b2-42b5-bcc9-27739a3ad4e6):
SELECT
"ci_job_artifacts"."project_id",
"ci_job_artifacts"."file_type",
"ci_job_artifacts"."size",
"ci_job_artifacts"."created_at",
"ci_job_artifacts"."updated_at",
"ci_job_artifacts"."expire_at",
"ci_job_artifacts"."file",
"ci_job_artifacts"."file_store",
"ci_job_artifacts"."file_sha256",
"ci_job_artifacts"."file_format",
"ci_job_artifacts"."file_location",
"ci_job_artifacts"."id",
"ci_job_artifacts"."job_id",
"ci_job_artifacts"."locked"
FROM
"ci_job_artifacts"
WHERE
"ci_job_artifacts"."expire_at" < '2021-10-15 00:13:30.139913'
AND "ci_job_artifacts"."locked" = 0
LIMIT 100;
Statistics:
Time: 3.924 ms
- planning: 3.886 ms
- execution: 0.038 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 1 (~8.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
Explain:
Limit (cost=0.12..3.06 rows=1 width=140) (actual time=0.004..0.005 rows=0 loops=1)
Buffers: shared hit=1
I/O Timings: read=0.000 write=0.000
-> Index Scan using ci_job_artifacts_expire_at_unlocked_idx on public.ci_job_artifacts (cost=0.12..3.06 rows=1 width=140) (actual time=0.002..0.003 rows=0 loops=1)
Index Cond: (ci_job_artifacts.expire_at < '2021-10-15 00:13:30.139913+00'::timestamp with time zone)
Buffers: shared hit=1
I/O Timings: read=0.000 write=0.000
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #327281 (closed)
Merge request reports
Activity
changed milestone to %14.5
added All SaaS CI artifacts Category:Build Artifacts Category:Continuous Integration Eng-ConsumerInfrastructure Eng-ProducerDevelopment Engineering Allocation FY22Q3 Pricing & Packaging Stretch Verify candidate VerifyP1 backend devopsverify grouppipeline security infradev maintenancerefactor missed:14.2 missed:14.3 missed:14.4 priority2 reliability sectionops severity2 workflowin dev labels
assigned to @mattkasa
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
added 1 commit
- 8e6227b0 - Use new locked column for Ci::JobArtifacts::DestroyAllExpiredService
- A deleted user
added feature flag label
1 Warning Please add a merge request type to this merge request. 1 Message CHANGELOG missing: If you want to create a changelog entry for GitLab FOSS, add the
Changelog
trailer to the commit message you want to add to the changelog.If you want to create a changelog entry for GitLab EE, also add the
EE: true
trailer to your commit message.If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Ryan Cobb ( @rcobb
) (UTC-7, same timezone as@mattkasa
)Stan Hu ( @stanhu
) (UTC-7, same timezone as@mattkasa
)To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Dangeradded 1 commit
- 1aef868b - Use new locked column for Ci::JobArtifacts::DestroyAllExpiredService
added 1 commit
- cd46f89d - Use new locked column for Ci::JobArtifacts::DestroyAllExpiredService
added 1 commit
- 73e62cf5 - Use new locked column for Ci::JobArtifacts::DestroyAllExpiredService
added 369 commits
-
73e62cf5...4ce6e16a - 368 commits from branch
master
- 4003c05a - Use new locked column for Ci::JobArtifacts::DestroyAllExpiredService
-
73e62cf5...4ce6e16a - 368 commits from branch
Allure report
allure-report-publisher
generated test report for 4003c05a!package-and-qa:
test reportmentioned in issue #322817 (closed)
added 1061 commits
-
4003c05a...dfa79015 - 1060 commits from branch
master
- d2e2e5c2 - Use new locked column for Ci::JobArtifacts::DestroyAllExpiredService
-
4003c05a...dfa79015 - 1060 commits from branch
- Resolved by Steve Abrams
@ali-gitlab Would you be able to take the first database review here?
requested review from @ali-gitlab
added 1 commit
- 32d8f618 - Use new locked column for Ci::JobArtifacts::DestroyAllExpiredService
added databasereviewed label
requested review from @sabrams and removed review request for @ali-gitlab
@ali-gitlab
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
requested review from @rcobb
mentioned in issue #295212 (closed)
added databaseapproved label and removed databasereviewed label
removed review request for @sabrams
removed review request for @rcobb
mentioned in issue #327281 (closed)
requested review from @stanhu
mentioned in commit d6fd2565
added workflowstaging-canary label and removed workflowin dev label
added workflowstaging label and removed workflowstaging-canary label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
mentioned in merge request !74132 (merged)
mentioned in issue haboustak/glartifacts#37
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
mentioned in merge request !67908 (closed)
mentioned in merge request !76504 (merged)
mentioned in issue #346261 (closed)
mentioned in merge request !113233 (merged)
added typefeature label
removed maintenancerefactor label
mentioned in issue #436448