Skip to content

Convert ci_builds-runner_id FK to LFK

What does this MR do and why?

Related to #356153

This MR deletes the foreign key of ci_builds#runner_id-ci_runners and adds a loose foreign key definition for it.

The migration and the code changes are generated based on the scripts/decomposition/generate-loose-foreign-key script: https://docs.gitlab.com/ee/development/database/loose_foreign_keys#the-scriptsdecompositiongenerate-loose-foreign-key

Background

Because of the foreign key constraint between Ci::Build and Ci::Runner, every time a runner is deleted the builds that were executed by this runner would need to be updated to have the runner_id value nullified.

When busy runners are deleted it causes massive spikes in number of updates to the ci_builds table:

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 Furkan Ayhan

Merge request reports

Loading