CI Partitions to have Loose Foreign Keys trigger installed
Context: #505813 (comment 2226473839)
It was discovered as part of this issue #505813 (closed) that CI new partitions, on p_ci_pipelines
and p_ci_builds
don't have LFK trigger installed. So as part of this issue we need to do the following:
- Add a new trigger function that is similar to
insert_into_loose_foreign_keys_deleted_records
, but instead receives the table name as part of its argument, instead of usingTG_TABLE_NAME
. That's becauseTG_TABLE_NAME
value changes depending on whether the statement ran on the partitioned table or partition. - Attach this trigger to all the existing CI partitions. And remove the old trigger on existing partitions that had the LFK trigger. Make the trigger add the partitioned table only.
- Make sure that this trigger is attached to the newly created partitions. See #505813 (comment 2235544598) for reference.
- Follow up MR. Remove
ci_pipelines
andci_builds
from LFK Yaml filegitlab/config/gitlab_loose_foreign_keys.yml
Todos
-
Add triggers to existing partitions. MR in review: !176031 -
Fix partition manager to automatically add triggers to newly created partitions.
References:
CC: @tianwenchen @ahegyi
Edited by Omar Qunsul