Use constant to refer to main database name
What does this MR do and why?
Related to #343047 (closed)
Introduce a constant that defines the default tracking database for background migrations and use it throughout, rather than various different hardcoded values of 'main'
or :main
.
This is part of the effort to make background migrations work with multiple databases, and so a transitional change to the end state. Once we have wired up the migration helpers to use the target database of the migration as the tracking database, we can remove the default database altogether and rely solely on the worker definition of their tracking databases.
How to set up and validate locally
The intent of this MR is to keep the current behavior the same, so we can directly exercise the worker to ensure it runs the job:
-
Setup some test migration job class:
module Gitlab module BackgroundMigration class MyTestJob def perform(*args) puts "args: #{args}" end end end end
-
Run the job inline with the existing worker:
BackgroundMigrationWorker.new.perform('MyTestJob', [10, 20])
-
Verify the output looks similar to:
args: [10, 20]
-
Schedule the job to run at a later time:
BackgroundMigrationWorker.perform_in(1.week, 'MyTestJob', [20, 30])
-
Force the job to run now anyhow:
Gitlab::BackgroundMigration.steal('MyTestJob')
-
Verify the output looks similar to:
args: [20, 30]
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Merge request reports
Activity
changed milestone to %14.5
assigned to @pbair
1 Message CHANGELOG missing: If you want to create a changelog entry for GitLab FOSS, add the
Changelog
trailer to the commit message you want to add to the changelog.If you want to create a changelog entry for GitLab EE, also add the
EE: true
trailer to your commit message.If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Magdalena Frankiewicz ( @m_frankiewicz
) (UTC+1, 6 hours ahead of@pbair
)Alex Kalderimis ( @alexkalderimis
) (UTC+0, 5 hours ahead of@pbair
)database Alexandru Croitor ( @acroitor
) (UTC+2, 7 hours ahead of@pbair
)Mayra Cabrera ( @mayra-cabrera
) (UTC-6, 1 hour behind@pbair
)To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Dangeradded 388 commits
-
13338d39...b580dde8 - 387 commits from branch
master
- cea6e300 - Use constant to refer to main database name
-
13338d39...b580dde8 - 387 commits from branch
added 377 commits
-
cea6e300...cc2f3a8c - 376 commits from branch
master
- a1b6da1c - Use constant to refer to main database name
-
cea6e300...cc2f3a8c - 376 commits from branch
changed milestone to %14.6
added missed:14.5 label
added 387 commits
-
a1b6da1c...06479426 - 386 commits from branch
master
- 2a7b5a73 - Use constant to refer to main database name
-
a1b6da1c...06479426 - 386 commits from branch
added typemaintenance label
added 2952 commits
-
2a7b5a73...d90198ee - 2951 commits from branch
master
- 78e592b8 - Use constant to refer to main database name
-
2a7b5a73...d90198ee - 2951 commits from branch
added 227 commits
-
78e592b8...80efecbd - 226 commits from branch
master
- 2f2b74f1 - Use constant to refer to main database name
-
78e592b8...80efecbd - 226 commits from branch
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
- Resolved by Dylan Griffith
@krasio can you review this first? Some cleanup for the background migration work.
requested review from @krasio
added databaseapproved label and removed databaseactive label
requested review from @DylanGriffith and removed review request for @krasio
@krasio
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
enabled an automatic merge when the pipeline for 1da23e90 succeeds
mentioned in commit e0eb631f
added workflowstaging-canary label and removed workflowin review label
added workflowstaging label and removed workflowstaging-canary label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
added devopsdata stores label and removed devopssystems label
added groupdatabase frameworks label and removed groupdatabase [DEPRECATED] label
added pipeline:mr-approved label