diff --git a/notifier/background_migration.rb b/notifier/background_migration.rb index 43361f3c583b9aa760463df8de804a5a29cce300..673785d5074d63c7ebd8acabdd864916d57fb271 100644 --- a/notifier/background_migration.rb +++ b/notifier/background_migration.rb @@ -75,7 +75,9 @@ class BackgroundMigration "Batch size: #{batch_size}", "N. of batches sampled: #{batches_sampled}", "N. of failed batches: #{batches_failed.size}" - ] + ].tap do |info| + info << "Failed batches: #{names_of_batches_failed}" if batches_failed.present? + end end def success? @@ -109,6 +111,10 @@ class BackgroundMigration end def batches_failed - batches.select { |batch| !batch.success? } + @batches_failed ||= batches.select { |batch| !batch.success? } + end + + def names_of_batches_failed + batches_failed.map { |b| b.name || b.statistics['name'] }.join(',') end end diff --git a/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt b/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt index 3382bf10b6de8cd8fa5666895c790b7ee54f5ee3..7f8a0077b49d25df285a5d46fd18dd6b846745e3 100644 --- a/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt +++ b/notifier/spec/fixtures/migration-testing/v4/expected-comment.txt @@ -244,6 +244,7 @@ Migrations included in this change have been executed on gitlab.com data for tes - Batch size: 150 - N. of batches sampled: 5 - N. of failed batches: 1 + - Failed batches: batch_5 Time estimation is conservative and based on sampling production data in a test environment. It represents the max time that migration could take. The actual time may differ from this estimation.