From 8c32bd8d525a49564015ad6ec7a81dd508b2e753 Mon Sep 17 00:00:00 2001 From: Brian Williams Date: Wed, 17 Dec 2025 11:37:27 -0600 Subject: [PATCH] Remove BackfillSecurityProjectTrackedContextsDefaultBranch migration This migration turned out to be very slow because it makes N+1 Gitaly calls. At the current rate, the GitLab.com migration will complete in about 2 years. Since migrations block GitLab upgrades and this is too slow, we need to remove it. Changelog: removed --- ..._project_tracked_contexts_default_branch.rb | 18 ++---------------- ..._project_tracked_contexts_default_branch.rb | 16 ++++++++++++++++ db/schema_migrations/20251217173006 | 1 + 3 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 db/post_migrate/20251217173006_remove_backfill_security_project_tracked_contexts_default_branch.rb create mode 100644 db/schema_migrations/20251217173006 diff --git a/db/post_migrate/20251205211140_queue_backfill_security_project_tracked_contexts_default_branch.rb b/db/post_migrate/20251205211140_queue_backfill_security_project_tracked_contexts_default_branch.rb index 2dfb588a5d63da..3d7f4aa9abf2d9 100644 --- a/db/post_migrate/20251205211140_queue_backfill_security_project_tracked_contexts_default_branch.rb +++ b/db/post_migrate/20251205211140_queue_backfill_security_project_tracked_contexts_default_branch.rb @@ -4,23 +4,9 @@ class QueueBackfillSecurityProjectTrackedContextsDefaultBranch < Gitlab::Databas milestone '18.7' restrict_gitlab_migration gitlab_schema: :gitlab_main_org - MIGRATION = "BackfillSecurityProjectTrackedContextsDefaultBranch" - DELAY_INTERVAL = 2.minutes - BATCH_SIZE = 1000 - SUB_BATCH_SIZE = 100 - def up - queue_batched_background_migration( - MIGRATION, - :projects, - :id, - job_interval: DELAY_INTERVAL, - batch_size: BATCH_SIZE, - sub_batch_size: SUB_BATCH_SIZE - ) + # This migration is removed by migration 20251217173006 because it is very slow. end - def down - delete_batched_background_migration(MIGRATION, :projects, :id, []) - end + def down; end end diff --git a/db/post_migrate/20251217173006_remove_backfill_security_project_tracked_contexts_default_branch.rb b/db/post_migrate/20251217173006_remove_backfill_security_project_tracked_contexts_default_branch.rb new file mode 100644 index 00000000000000..762b7c311138e7 --- /dev/null +++ b/db/post_migrate/20251217173006_remove_backfill_security_project_tracked_contexts_default_branch.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class RemoveBackfillSecurityProjectTrackedContextsDefaultBranch < Gitlab::Database::Migration[2.3] + milestone '18.8' + restrict_gitlab_migration gitlab_schema: :gitlab_main_org + + MIGRATION = "BackfillSecurityProjectTrackedContextsDefaultBranch" + + def up + delete_batched_background_migration(MIGRATION, :projects, :id, []) + end + + def down + # no-op + end +end diff --git a/db/schema_migrations/20251217173006 b/db/schema_migrations/20251217173006 new file mode 100644 index 00000000000000..575a945c3b104e --- /dev/null +++ b/db/schema_migrations/20251217173006 @@ -0,0 +1 @@ +d5f7b6ca821ad5b3f77801366e3c9bbaa1e47979cdd7cbe3170be2bb777a2b5f \ No newline at end of file -- GitLab