Swap FK ci_project_monthly_usages.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): grouppipeline execution 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: -
Possible Sidekiq workers that may load directly and possibly lead to exceptions. Please explain: -
Possible user impact to be evaluated or mitigated. Please explain: -
@fabiopitino
: The record is accessed byproject_id
throughCi::ProjectMirror.by_namespace_id
when inspecting CI/CD minutes usage of the namespace. Via GraphQL we access theCi::Minutes::NamespaceMonthlyUsage
for a given namespace and from it we can access the breakdown of usage per project. The returningProjectMonthlyUsageType
exposes the project name for each record:object.project.name
whereobject
is an instance ofCi::Minutes::ProjectMonthlyUsage
. If project disappears and returnsnil
,object.project.name
could raise an exception on.name
method. We could fix it with:object.project&.name
. - The impact should be small since this GraphQL query is used in the CI minutes quota page. The error would occur if the user visits the page while the project hasn't been removed by the LFK.
-
-
Is this FK safe to be removed to avoid LOCKing problems? (Explanation: &7249 (comment 819662046)). Please expalin:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Douglas Barbosa Alexandre