Commit ef1e8f46 authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'fix_post_migrate_migrate_in' into 'master'

Fix migrate_in not working within a transaction

See merge request gitlab-org/gitlab!69631
parents 52f7c141 e11ba41a
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1] class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
BATCH_SIZE = 5_000 BATCH_SIZE = 5_000
MIGRATION_CLASS = 'MigrateMergeRequestDiffCommitUsers' MIGRATION_CLASS = 'MigrateMergeRequestDiffCommitUsers'
STEAL_MIGRATION_CLASS = 'StealMigrateMergeRequestDiffCommitUsers' STEAL_MIGRATION_CLASS = 'StealMigrateMergeRequestDiffCommitUsers'
...@@ -15,6 +17,7 @@ class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1] ...@@ -15,6 +17,7 @@ class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1]
return if old_jobs.empty? return if old_jobs.empty?
transaction do
# This ensures we stop processing the old ranges, as the background # This ensures we stop processing the old ranges, as the background
# migrations skip already processed jobs. # migrations skip already processed jobs.
Gitlab::Database::BackgroundMigrationJob Gitlab::Database::BackgroundMigrationJob
...@@ -40,6 +43,7 @@ class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1] ...@@ -40,6 +43,7 @@ class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1]
end end
Gitlab::Database::BackgroundMigrationJob.insert_all!(rows) Gitlab::Database::BackgroundMigrationJob.insert_all!(rows)
end
job = Gitlab::Database::BackgroundMigrationJob job = Gitlab::Database::BackgroundMigrationJob
.for_migration_class(MIGRATION_CLASS) .for_migration_class(MIGRATION_CLASS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment