Skip to content

Resolve "Batched background migration marked as finished, but there are failed jobs"

What does this MR do and why?

Since we could not find the root cause of the problem, we decided to add a new validation to the model. This will prevent having background migration in an inconsistent state. When we move the background migration to the state finished we validate if all jobs have succeeded.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Create a new background migration (status=active) Example migration = Gitlab::Database::BackgroundMigration::BatchedMigration.create!(..., status: :active)
  2. Create a new background migration job (status=failed) migration.batched_jobs.create!(..., status: :failed)
  3. Execute migration.finished!
  4. You should see an error message

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #342352 (closed)

Edited by Diogo Frazão

Merge request reports

Loading