Dev instance contains improper storage configuration
Details
- Point of contact for this request: @skarbek
- If a call is needed, what is the proposed date and time of the call: Date and Time
- Additional call details (format, type of call): additional details
SRE Support Needed
When making certain application changes, settings may not take effect as checks on the configuration will cause an error. On the console, this is hidden, but we can view this when executed in a different way:
ApplicationSetting.update(foo: bar)
The error is hidden. However, if we execute a config change like so:
irb(main):008:0> ApplicationSetting.update!(foo: bar)
/opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/validations.rb:80:in `raise_validation_error': Validation failed: Repository storages weighted can't include: alternate (ActiveRecord::RecordInvalid)
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/validations.rb:53:in `save!'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/transactions.rb:302:in `block in save!'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/connection_adapters/abstract/database_statements.rb:314:in `transaction'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `public_send'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/load_balancing/connection_proxy.rb:127:in `block in write_using_load_balancer'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/load_balancing/load_balancer.rb:141:in `block in read_write'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/load_balancing/load_balancer.rb:228:in `retry_with_backoff'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/load_balancing/load_balancer.rb:130:in `read_write'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/load_balancing/connection_proxy.rb:126:in `write_using_load_balancer'
from /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/load_balancing/connection_proxy.rb:78:in `transaction'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/transactions.rb:302:in `save!'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/suppressor.rb:54:in `save!'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/persistence.rb:782:in `block in update!'
from /opt/gitlab/embedded/lib/ruby/gems/3.2.0/gems/activerecord-7.0.8.4/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
... 33 levels...
We've got our stack trace. So what's wrong with our configuration?
The Dev instance is making use a configuration preventing settings from properly applying, use this issue to discover the issue and rectify. Additional notes from Slack:
@godfat-gitlab - We might want to check repository_storages_weighted in the current application setting and Gitlab.config.repositories.storages.keys
irb(main):001:0> ApplicationSetting.update(max_yaml_size_bytes: 3.megabytes)
=>
[#<ApplicationSetting:0x00007f98f9b2ac98
id: 27,
default_projects_limit: 100000,
signup_enabled: false,
...
@balasankarc - @mbobin This is what I have as result of my update attempt.
@balasankarc - @godfat-gitlab - repository_storages_weighted: {"default"=>100, "alternate"=>0},
@godfat-gitlab - Did we change gitlab.yml on dev somehow?
Gitlab.config.repositories.storages.keys
=> ["default"]
@godfat-gitlab - It reads to me that the application setting has alternate but then gitlab.yml doesn't, and that's failing the validation