Efficiently remove expired artifacts in `ExpireBuildArtifactsWorker`
What does this MR do?
ExpireBuildArtifactsWorker
is a cron worker for removing expired artifacts, however, it's not working today because of its inefficiency.
This merge request addresses the inefficiency. In fact, it improves the following things
- Use
ci_job_artifacts.expire_at
column for searching expired artifacts. This column has been indexed already. Also, it's easy to find target rows because each row represents one artifact unit. - We don't need to consider legacy job artifacts anymore, since all rows have already been migrated by https://gitlab.com/gitlab-org/gitlab-ce/issues/46866
ci_new_expire_job_artifacts_service
flag
This feature is behind To enable this feature, execute Feature.enable(:ci_new_expire_job_artifacts_service)
What are the relevant issue numbers?
Close https://gitlab.com/gitlab-org/gitlab-ce/issues/41057
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary - [-] Documentation created/updated via this MR
-
Tests added for this feature/bug - [-] Tested in all supported browsers
-
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides - [-] Link to e2e tests MR added if this MR has Requires e2e tests label. See the Test Planning Process.
-
Security reports checked/validated by reviewer
Edited by Kamil Trzciński