Skip to content

Define id trigger on p_ci_builds routing table

Marius Bobin requested to merge mb-421173-id-trigger into master

What does this MR do and why?

In https://gitlab.com/gitlab-org/gitlab/-/blob/7343a4ed1e8d59c33d1db6756d3efd507e868043/db/post_migrate/20230809090349_ensure_id_uniqueness_for_p_ci_builds_v2.rb and later in https://gitlab.com/gitlab-org/gitlab/-/blob/7343a4ed1e8d59c33d1db6756d3efd507e868043/db/post_migrate/20230816111730_ensure_id_uniqueness_for_p_ci_builds_v3.rb for self managed, we changed the id assignment from the default function to a trigger to prevent users/developers from manually assigning ids to builds in order to enforce the uniqueness across partitions.

Because we were still running PG12 in production at that time we could not create the triggers on the partitioned table and we had to do it on each partition. Now that we have PG14 we can move the trigger on the partitioned table and it will be executed on all partitions without having to create it after we add new partitions.

Related to #421173 (closed)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

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 Marius Bobin

Merge request reports