From 61ed77f333bc6b6f6ad4ac496d586c33f9bcfb1c Mon Sep 17 00:00:00 2001 From: gdk Date: Tue, 21 Oct 2025 23:21:52 +0000 Subject: [PATCH] Finalize BBM BackfillMergeRequestCleanupSchedulesProjectId This migration was finished at `2025-09-09 00:58:03 UTC`, you can confirm the status using our [batched background migration chatops commands](https://docs.gitlab.com/ee/development/database/batched_background_migrations.html#monitor-the-progress-and-status-of-a-batched-background-migration). To confirm it is finished you can run: ``` /chatops run batched_background_migrations status 2001051 --database main ``` The last time this background migration was triggered was in [db/post_migrate/20250820170760_requeue_backfill_merge_request_cleanup_schedules_project_id.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/post_migrate/20250820170760_requeue_backfill_merge_request_cleanup_schedules_project_id.rb) You can read more about the process for finalizing batched background migrations in https://docs.gitlab.com/ee/development/database/batched_background_migrations.html . As part of our process we want to ensure all batched background migrations have had at least one [required stop](https://docs.gitlab.com/ee/development/database/required_stops.html) to process the migration. Therefore we can finalize any batched background migration that was added before the last required stop. This change was generated by [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper) in [CI](https://ops.gitlab.net/gitlab-com/database-team/gitlab-com-database-testing/-/jobs/20810062) using the `Keeps::OverdueFinalizeBackgroundMigration` keep. To provide feedback on your experience with `gitlab-housekeeper` please create an issue with the label ~"GitLab Housekeeper" and consider pinging the author of this keep. Changelog: other --- ...e_request_cleanup_schedules_project_id.yml | 5 +++-- ...ge_request_cleanup_schedules_project_id.rb | 21 +++++++++++++++++++ db/schema_migrations/20251021232133 | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 db/post_migrate/20251021232133_finalize_hk_backfill_merge_request_cleanup_schedules_project_id.rb create mode 100644 db/schema_migrations/20251021232133 diff --git a/db/docs/batched_background_migrations/backfill_merge_request_cleanup_schedules_project_id.yml b/db/docs/batched_background_migrations/backfill_merge_request_cleanup_schedules_project_id.yml index a93d6f33a6e67b..257ec5924938ad 100644 --- a/db/docs/batched_background_migrations/backfill_merge_request_cleanup_schedules_project_id.yml +++ b/db/docs/batched_background_migrations/backfill_merge_request_cleanup_schedules_project_id.yml @@ -1,8 +1,9 @@ --- migration_job_name: BackfillMergeRequestCleanupSchedulesProjectId -description: Backfills sharding key `merge_request_cleanup_schedules.project_id` from `merge_requests`. +description: Backfills sharding key `merge_request_cleanup_schedules.project_id` from + `merge_requests`. feature_category: code_review_workflow introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/180840 milestone: '18.4' queued_migration_version: 20250820170760 -finalized_by: # version of the migration that finalized this BBM +finalized_by: '20251021232133' diff --git a/db/post_migrate/20251021232133_finalize_hk_backfill_merge_request_cleanup_schedules_project_id.rb b/db/post_migrate/20251021232133_finalize_hk_backfill_merge_request_cleanup_schedules_project_id.rb new file mode 100644 index 00000000000000..1a5cfe71b5605d --- /dev/null +++ b/db/post_migrate/20251021232133_finalize_hk_backfill_merge_request_cleanup_schedules_project_id.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class FinalizeHkBackfillMergeRequestCleanupSchedulesProjectId < Gitlab::Database::Migration[2.3] + milestone '18.6' + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main_org + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'BackfillMergeRequestCleanupSchedulesProjectId', + table_name: :merge_request_cleanup_schedules, + column_name: :merge_request_id, + job_arguments: [:project_id, :merge_requests, :target_project_id, :merge_request_id], + finalize: true + ) + end + + def down; end +end diff --git a/db/schema_migrations/20251021232133 b/db/schema_migrations/20251021232133 new file mode 100644 index 00000000000000..4fd3894f127ca7 --- /dev/null +++ b/db/schema_migrations/20251021232133 @@ -0,0 +1 @@ +f5bbb8074a8b41db8f5e5fd51eaa17bab6b43aaa07b326d5eb9eb0bcb97a121a \ No newline at end of file -- GitLab