Skip to content

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

Availability and Testing

Edited by Bob Van Landuyt

Merge request reports