summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-08-25 12:16:28 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-08-25 12:16:28 +0000
commit0036fc6fbcef39d47479193834607f4a0be272e0 (patch)
tree32c5804b9d8b3c8d7e9809035d8e28d44b29f1e3 /db
parent676f77269daa8a8c697bc34666bf3b00d540099b (diff)
parent4737fc3beeb3785c2f75ee0749830c40a901e061 (diff)
downloadgitlab-ce-0036fc6fbcef39d47479193834607f4a0be272e0.tar.gz
Merge branch 'backstage/gb/improve-stages-statuses-migration' into 'master'
Adjust a range and a batch sizes in stages statuses migration Closes #36793 See merge request !13767
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20170711145558_migrate_stages_statuses.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/db/post_migrate/20170711145558_migrate_stages_statuses.rb b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
index 5a24fb1307f..aeb900354db 100644
--- a/db/post_migrate/20170711145558_migrate_stages_statuses.rb
+++ b/db/post_migrate/20170711145558_migrate_stages_statuses.rb
@@ -6,7 +6,7 @@ class MigrateStagesStatuses < ActiveRecord::Migration
disable_ddl_transaction!
BATCH_SIZE = 10000
- RANGE_SIZE = 1000
+ RANGE_SIZE = 100
MIGRATION = 'MigrateStageStatus'.freeze
class Stage < ActiveRecord::Base
@@ -17,10 +17,10 @@ class MigrateStagesStatuses < ActiveRecord::Migration
def up
Stage.where(status: nil).each_batch(of: BATCH_SIZE) do |relation, index|
relation.each_batch(of: RANGE_SIZE) do |batch|
- range = relation.pluck('MIN(id)', 'MAX(id)').first
- schedule = index * 5.minutes
+ range = batch.pluck('MIN(id)', 'MAX(id)').first
+ delay = index * 5.minutes
- BackgroundMigrationWorker.perform_in(schedule, MIGRATION, range)
+ BackgroundMigrationWorker.perform_in(delay, MIGRATION, range)
end
end
end