Skip to content

Improve background migration helpers

Krasimir Angelov requested to merge 503461-improve-bbm-helpers into master

What does this MR do and why?

Update helpers to process background migrations with different gitlab_schema when it is compatible with the connection.

This will resolve issues with migrations not being found when table's gitlab_schema change while migration is in progress.

#503461

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Create migration with restrict_gitlab_migration gitlab_schema: :gitlab_main to enqueue background migration.
  2. Create another migration with restrict_gitlab_migration gitlab_schema: :gitlab_main_cell to finalize it.
  3. Run DBLAB_ENVIRONMENT=true be rails db:migrate
    • On master this will fail with
      StandardError: An error has occurred, all later migrations canceled:
      
      called ensure_batched_background_migration_is_finished with non-existent migration name
    • On this branch it will succeed and the migration will be finalized.

Related to #503461

Edited by Krasimir Angelov

Merge request reports

Loading