Skip to content

Efficiently remove expired artifacts in `ExpireBuildArtifactsWorker`

Shinya Maeda requested to merge expire-job-artifacts-worker into master

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

This feature is behind ci_new_expire_job_artifacts_service flag

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?

Edited by Kamil Trzciński

Merge request reports