Finalize BBMs that migrate existing iids to ci_pipeline_iids

What does this MR do and why?

In !213722 (diffs), we introduced BBMs that copy existing iids from p_ci_pipeline to p_ci_pipeline_iids. One BBM per partition was queued. This is part of our long term solution to prevent duplicate pipeline iids.

We can now finalize them because:

  1. The migrations were introduced in %18.7, which is before the last required stop in %18.8.

  2. These are all the BBMs for 'BackfillPCiPipelineIids' that currently exist on GitLab.com:

gitlabhq_dblab=# SELECT id, status, job_class_name, table_name, column_name, job_arguments, started_at, finished_at FROM batched_background_migrations WHERE job_class_name = 'BackfillPCiPipelineIids';
   id    | status |     job_class_name      |                 table_name                 | column_name | job_arguments |          started_at           |          finished_at          
---------+--------+-------------------------+--------------------------------------------+-------------+---------------+-------------------------------+-------------------------------
 3000526 |      3 | BackfillPCiPipelineIids | gitlab_partitions_dynamic.ci_pipelines     | id          | []            | 2025-12-15 08:08:27.952921+00 | 2025-12-30 20:06:05.02278+00
 3000527 |      3 | BackfillPCiPipelineIids | gitlab_partitions_dynamic.ci_pipelines_103 | id          | []            | 2025-12-15 08:08:27.98391+00  | 2025-12-26 02:29:03.994947+00
 3000528 |      3 | BackfillPCiPipelineIids | gitlab_partitions_dynamic.ci_pipelines_104 | id          | []            | 2025-12-15 08:08:28.011038+00 | 2025-12-27 01:28:03.509006+00
 3000529 |      3 | BackfillPCiPipelineIids | gitlab_partitions_dynamic.ci_pipelines_105 | id          | []            | 2025-12-15 08:08:28.038866+00 | 2025-12-27 17:23:04.940102+00
 3000530 |      3 | BackfillPCiPipelineIids | gitlab_partitions_dynamic.ci_pipelines_106 | id          | []            | 2025-12-15 08:08:28.063507+00 | 2025-12-28 11:32:05.534052+00
 3000531 |      3 | BackfillPCiPipelineIids | gitlab_partitions_dynamic.ci_pipelines_107 | id          | []            | 2025-12-15 08:08:28.086072+00 | 2025-12-29 15:15:01.895324+00
(6 rows)

ChatOps statuses confirm the BBMs are complete on GitLab.com:

/chatops run batched_background_migrations list --database ci --job-class-name BackfillPCiPipelineIids

Screenshot_2026-02-17_at_1.52.44_PMScreenshot_2026-02-17_at_1.53.02_PM


We can simply run ensure_batched_background_migration_is_finished on each currently existing partition because no partitions were detached/deleted for p_ci_pipelines (and we don't have any plans to in the near future). So this should cover all BBM records we have for the job class 'BackfillPCiPipelineIids'.

We skip any new p_ci_pipelines partitions that don't have a corresponding BBM record.

References

How to set up and validate locally

bundle exec rails db:migrate

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #582338 (closed)

Edited by Leaminn Ma

Merge request reports

Loading