Add context to background migrations
What does this MR do?
This adds a more helpful caller_id
value in the context for background migrations. Otherwise the first value would be nil
, and for migrations scheduling the next batch when they're done, the value would be BackgroundMigrationWorker
.
This changes the value for the first background migration in the queue to the migration that scheduled it. For any subsequent migrations scheduled, it would be the class of the Gitlab::Database::BackgroundMigrations
that scheduled it.
To do this, I'm adding a few new helper methods to our migrations that should be used for scheduling background migrations instead.
This also adds a cop checking that no BackgroundMigrationWorker
is scheduled manually. The cop only runs on migrations after a certain timestamp to avoid having to update all migrations that will never run anymore anyway.
This is part of gitlab-com/gl-infra/scalability#141 (closed)
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done