Fixing database backup rake task in single-db-two-connections mode
What does this MR do and why?
Extracting a fix from this MR: !112731 (merged)
In !112731 (merged) we are adding tests coverage for the new database setup mode, which is single-db-ci-connection
. Where GitLab connects to a Single Database, but through two different set of connection pool. One for gitlab_main
tables, and one for gitlab_ci
.
While working on that MR, we discovered an issue with the backup rake task. When running in this mode single-db-ci-connection
, it backups the same (only) database twice.
This MR extracts the fix into its own separate MR, based on this comment
How to set up and validate locally
- Make sure you are running in
single-db-ci-connection
mode. Yourconfig/database.yml
should look like
development:
main: &development_main
adapter: postgresql
encoding: unicode
database: gitlabhq_development
ci:
adapter: postgresql
encoding: unicode
database: gitlabhq_development # this should be the same database name as in main
database_tasks: false # This is important
- On the
master
branch, run this command
rake gitlab:backup:create SKIP=repositories,builds,artifacts,pages,lfs,terraform_state,registry,packages
It will generate a newly compressed file in the tmp/backups
folder. If you list the files inside this file, using the command
tar --list -f tmp/backups/1679331599_2023_03_20_15.10.0-pre_gitlab_backup.tar
You will get
backup_information.yml
db/
db/ci_database.sql.gz # This should not be there
db/database.sql.gz
uploads.tar.gz
- On this branch, you should get the following instead
backup_information.yml
db/
db/database.sql.gz
uploads.tar.gz
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.
Related to #391646 (closed)