Skip to content

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:

  1. 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 using TG_TABLE_NAME. That's because TG_TABLE_NAME value changes depending on whether the statement ran on the partitioned table or partition.
  2. 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.
  3. Make sure that this trigger is attached to the newly created partitions. See #505813 (comment 2235544598) for reference.
  4. (In the Milestone %17.11 because we need a required stop) Follow up MR. Remove ci_pipelines and ci_builds from LFK Yaml file gitlab/config/gitlab_loose_foreign_keys.yml. MR is ready here: !180537 (closed)

Todos

References:

CC: @tianwenchen @ahegyi

Edited by Omar Qunsul