Commit eff4c099 authored by pbair's avatar pbair

Existing migration method should pass correct args

Update the existing migration helper method
`initialize_conversion_of_integer_to_bigint` to pass the arguments in
the correct order to match the updated background job. The helper is
currently unused, but better to keep it consistent for now.
parent 64434884
......@@ -9,14 +9,11 @@ module Gitlab
return unless active_migration&.interval_elapsed?
next_batched_job = create_next_batched_job!(active_migration)
if next_batched_job.nil?
if next_batched_job = create_next_batched_job!(active_migration)
migration_wrapper.perform(next_batched_job)
else
finish_active_migration(active_migration)
return
end
migration_wrapper.perform(next_batched_job)
end
private
......
......@@ -1015,7 +1015,7 @@ module Gitlab
'CopyColumnUsingBackgroundMigrationJob',
interval,
batch_size: batch_size,
other_job_arguments: [table, primary_key, column, tmp_column, sub_batch_size],
other_job_arguments: [table, primary_key, sub_batch_size, column, tmp_column],
track_jobs: true,
primary_column_name: primary_key
)
......
......@@ -56,7 +56,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigration, type: :m
context 'when the migration has no last_job' do
let(:batched_migration) { build(:batched_background_migration) }
it 'returns false' do
it 'returns true' do
expect(batched_migration.interval_elapsed?).to eq(true)
end
end
......
......@@ -137,9 +137,9 @@ RSpec.describe Gitlab::Database::BackgroundMigration::Scheduler, '#perform' do
end
context 'when the bounds of the next batch exceed the migration maximum value' do
let!(:event1) { create(:event) }
let!(:event2) { create(:event) }
let!(:event3) { create(:event) }
let!(:events) { create_list(:event, 3) }
let(:event1) { events[0] }
let(:event2) { events[1] }
context 'when the batch maximum exceeds the migration maximum' do
it 'clamps the batch maximum to the migration maximum' do
......
......@@ -1720,7 +1720,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
.with(
2.minutes,
'CopyColumnUsingBackgroundMigrationJob',
[event.id, event.id, :events, :id, :id, 'id_convert_to_bigint', 100]
[event.id, event.id, :events, :id, 100, :id, 'id_convert_to_bigint']
)
expect(Gitlab::BackgroundMigration)
......
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