Local GDK development should be configured with 2 write connections by default like phase 7
Once we ship phase 7 in &6160 (closed) we will have 2 separate write connections pointing to two DBs. We should do the same for local dev by default so we can catch issues earlier.~ We should start preparing the development environment for most developers to run like phase 7 (in which GitLab has 2 separate connections to 2 separate databases) to catch any potential issues earlier
Proposal
- 
Encourage group of beta testers to use distinct ci:database => #356353 (closed)
- 
Gather feedback ⏳ 
- 
Enable multiple databases by default in GDK => gitlab-development-kit!2496 (merged) 
- 
Write guide on how to switch back from two databases to single database => !85374 (closed) 
- 
Enable multiple databases by default in GCK => gitlab-compose-kit!206 (merged) 
FAQ / Troubleshooting
- 
I would like to stay on single database. - Answer : You have two options:
- Use single database, but two different connections (preferred)
 gdk config set gitlab.rails.databases.ci.use_main_database true gdk reconfigure- Use single database only (less preferred)
 gdk config set gitlab.rails.databases.ci.enabled false gdk reconfigure
- 
Can I pin my config on single database prior to the switch ? - Answer : Yes, set the above configurations. GDK will respect your config
 
- 
What Slack channel is best to ask questions about this ? - Answer : The #g_shardingchannel
 
- Answer : The 
- 
I can't see any CI data anymore when I switched back to a single database. - Answer: The data in the separate ci:database will remain there. You will not be able to see CI data
- For now, we recommend you create a new GDK instance to test with a single database.
 
- Answer: The data in the separate 
- 
What are the differences in multiple databases ? - Answer: It's based on Rail's multiple database support. Most things will be the same.
- Certain commands like bundle exec rails db:migrate:downwill need to be run like this now:- bundle exec rails db:migrate:down:main
- bundle exec rails db:migrate:down:ci
 
- Read https://guides.rubyonrails.org/active_record_multiple_databases.html for reference
 
- 
What is the plan ? - Answer: Assuming this test goes well, we plan to update GDK to:
- !82090 (merged) Enable multiple databases on CI (DONE)
- 
gitlab-development-kit!2464 (merged) use multiple database connections, but same underlying database (gitlab.rails.databases.ci.enabledtotrue,gitlab.rails.databases.ci.use_main_databasetotrue). (DONE)
- use multiple database connections, with distinct underlying databases (gitlab.rails.databases.ci.enabledtotrue,gitlab.rails.databases.ci.use_main_databasetofalse). Target date: 2022-04-20
- Note in next major milestone %16.0 we plan to make multiple databases mandatory for all GitLab instances.
 
 
- Answer: Assuming this test goes well, we plan to update GDK to:
Edited  by Thong Kuah