Skip to content

Swap FK ci_runner_projects.project_id to projects for LFK

What does this MR do and why?

Per &7249 (closed)

As part of our CI "decomposition" efforts we need to remove all foreign keys that are cross-database (ie. between the planned main and ci databases). We are going to replace them all with "loose foreign keys".

Related: #348267 (closed)

Validations

  • Best team to review (check off when reviewed): grouprunner devopsverify
  • No way for user to access once parent is deleted. Please explain:
  • Possible to access once parent deleted but low user impact. Please explain:

    Currently I don't see a way to access a project from a runner directly, other than situations like counting the number of projects that a runner is associated with, where we might get inflated numbers during a few minutes. It will become possible in the near future due to an upcoming projects GraphQL field that will be introduced in CiRunnerType which will allow you to query it for the associated projects, but we can try to exclude the unreachable project from the results. Another minor situation that comes to mind is that User.ci_owned_runners might return runners for projects that have been deleted (exposed through REST API and used in RunnerPolicy for CRUD permissions).

  • Possible Sidekiq workers that may load directly and possibly lead to exceptions. Please explain:
  • Possible user impact to be evaluated or mitigated. Please explain:
  • Is this FK safe to be removed to avoid LOCKing problems? (Explanation: &7249 (comment 819662046)). Please explain: Yes. The ci_runner_projects is not high traffic 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 Kamil Trzciński

Merge request reports