From 5418936f45034ee6567fe086cce88995252cba6f Mon Sep 17 00:00:00 2001 From: gdk Date: Thu, 10 Jul 2025 23:26:06 +0000 Subject: [PATCH] Finalize BBM BackfillScanResultPoliciesNamespaceId This migration was finished at `2025-03-05 12:39:01 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 2000877 --database main ``` The last time this background migration was triggered was in [db/post_migrate/20250301125858_queue_backfill_scan_result_policies_namespace_id.rb](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/post_migrate/20250301125858_queue_backfill_scan_result_policies_namespace_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/19262070) 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 --- ...fill_scan_result_policies_namespace_id.yml | 2 +- ...kfill_scan_result_policies_namespace_id.rb | 22 +++++++++++++++++++ db/schema_migrations/20250710232543 | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/post_migrate/20250710232543_finalize_hk_backfill_scan_result_policies_namespace_id.rb create mode 100644 db/schema_migrations/20250710232543 diff --git a/db/docs/batched_background_migrations/backfill_scan_result_policies_namespace_id.yml b/db/docs/batched_background_migrations/backfill_scan_result_policies_namespace_id.yml index c86ac244ae9767..3e9f35cc2a510b 100644 --- a/db/docs/batched_background_migrations/backfill_scan_result_policies_namespace_id.yml +++ b/db/docs/batched_background_migrations/backfill_scan_result_policies_namespace_id.yml @@ -5,4 +5,4 @@ feature_category: security_policy_management introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183125 milestone: '17.10' queued_migration_version: 20250301125858 -finalized_by: # version of the migration that finalized this BBM +finalized_by: '20250710232543' diff --git a/db/post_migrate/20250710232543_finalize_hk_backfill_scan_result_policies_namespace_id.rb b/db/post_migrate/20250710232543_finalize_hk_backfill_scan_result_policies_namespace_id.rb new file mode 100644 index 00000000000000..46689cdc73ad3d --- /dev/null +++ b/db/post_migrate/20250710232543_finalize_hk_backfill_scan_result_policies_namespace_id.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class FinalizeHkBackfillScanResultPoliciesNamespaceId < Gitlab::Database::Migration[2.3] + milestone '18.2' + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main_cell + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'BackfillScanResultPoliciesNamespaceId', + table_name: :scan_result_policies, + column_name: :id, + job_arguments: [:namespace_id, :security_orchestration_policy_configurations, :namespace_id, + :security_orchestration_policy_configuration_id], + finalize: true + ) + end + + def down; end +end diff --git a/db/schema_migrations/20250710232543 b/db/schema_migrations/20250710232543 new file mode 100644 index 00000000000000..8748af2939ee98 --- /dev/null +++ b/db/schema_migrations/20250710232543 @@ -0,0 +1 @@ +14644e4b7507cd10b7930b73b70d6d78468fcf99abe61d6289a38f64e4eef11a \ No newline at end of file -- GitLab