Skip to content

Preemptively destroy project-related CI records before the Project#destroy callbacks

drew stachon requested to merge destroy-project-related-ci-records into master

What does this MR do and why?

This merge request adds code to specifically query and destroy Pipeline, JobArtifact, and Build records associated with a Project before we destroy the Project itself. Right now, the dependent: :destroy associations are too unwieldy and prevent use from being able to destroy projects with large CI histories.

While this is overtly an improvement for Projects::DestroyService performance https://gitlab.com/gitlab-org/gitlab/-/issues/24644, it's also progress towards #340256 (closed), which is a high priority ~"sharding-blocker".

Rollout issue: #341936 (closed)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by drew stachon

Merge request reports