Cells: ApplicationSetting should not be reset by seeding
When setting up a secondary Cell, db:seed_fu
is run.
Seeding is fine for the main
, and ci
databases but it should not happen for main_clusterwide
. Otherwise it corrupts data already existing in the primary. Tables / model affected include:
ApplicationSetting
This was found from gitlab-development-kit!3142 (comment 1395327923):
== Seed from /Users/tkuah/code/gdk3/gitlab/db/fixtures/development/01_admin.rb
/Users/tkuah/.rbenv/versions/3.0.5/lib/ruby/gems/3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32: warning: ⛔️ WARNING: Sidekiq testing API enabled, but this is not the test environment. Your jobs will not go to Redis.
.
OK
== Seed from /Users/tkuah/code/gdk3/gitlab/db/fixtures/development/02_application_settings.rb
Creating the default ApplicationSetting record.
Enable hashed storage for every new projects.
rake aborted!
OpenSSL::Cipher::CipherError:
/Users/tkuah/code/gdk3/gitlab/vendor/gems/attr_encrypted/lib/attr_encrypted.rb:242:in `attr_decrypt'
/Users/tkuah/code/gdk3/gitlab/vendor/gems/attr_encrypted/lib/attr_encrypted.rb:331:in `attr_decrypt'
/Users/tkuah/code/gdk3/gitlab/vendor/gems/attr_encrypted/lib/attr_encrypted.rb:163:in `block (2 levels) in attr_encrypted'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `public_send'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `block in write_using_load_balancer'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:127:in `block in read_write'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:198:in `retry_with_backoff'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:116:in `read_write'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:126:in `write_using_load_balancer'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:78:in `transaction'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `public_send'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `block in write_using_load_balancer'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:127:in `block in read_write'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:198:in `retry_with_backoff'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:116:in `read_write'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:126:in `write_using_load_balancer'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:78:in `transaction'
(eval):8:in `block (2 levels) in run_file'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `public_send'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `block in write_using_load_balancer'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:127:in `block in read_write'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:198:in `retry_with_backoff'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/load_balancer.rb:116:in `read_write'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:126:in `write_using_load_balancer'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:78:in `transaction'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database.rb:368:in `block in transaction'
/Users/tkuah/code/gdk3/gitlab/lib/gitlab/database.rb:367:in `transaction'
/Users/tkuah/.rbenv/versions/3.0.5/bin/bundle:25:in `load'
/Users/tkuah/.rbenv/versions/3.0.5/bin/bundle:25:in `<main>'
Tasks: TOP => db:seed_fu
(See full trace by running task with --trace)
ERROR: 'support/exec-cd gitlab ../support/bundle-exec rake db:seed_fu' failed. Retrying
Current status [Updated]
One solution was explored in the MR which was to skip the seeds on the 2nd Cell. But we decided in the discussion thread to try a different approach which is to create the seeds from any cell in case they didn't exist before, in other words making rake db:seed_fu
idempotent. But we have 3 other issues blocked by this issue to solve other sub-problems with the seeds, for example creating projects on non-primary cells are still broken because of conflicts on the routes.
Groups/Projects created by the 2nd Cell
This might still be done as part of: #426775 (closed)
Also to avoid conflicts on the routes
of the groups/projects created by the 2nd Cell, we can add cell/
to the path of all the groups/projects. By making them all under 1 big group. In a later issues we can make this group name cell
configurable in case we wanted to run development
seeds on Cell3, Cell4, ...