Skip to content

Redis multistore feature flag doesn't work on an empty DB

With an empty database gitlabhq_test database, the DB setup failed:

$ RAILS_ENV=test bundle exec rake db:setup
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "feature_gates" does not exist
LINE 8:  WHERE a.attrelid = '"feature_gates"'::regclass
                            ^
/Users/stanhu/gitlab/gdk-ee/gitlab/lib/gitlab/database/schema_cache_with_renamed_table.rb:25:in `columns'
/Users/stanhu/gitlab/gdk-ee/gitlab/lib/gitlab/database/schema_cache_with_renamed_table.rb:29:in `columns_hash'
/Users/stanhu/gitlab/gdk-ee/gitlab/lib/feature.rb:86:in `enabled?'
/Users/stanhu/gitlab/gdk-ee/gitlab/lib/gitlab/redis/multi_store.rb:102:in `use_primary_store_as_default?'
/Users/stanhu/gitlab/gdk-ee/gitlab/lib/gitlab/redis/multi_store.rb:108:in `default_store'
/Users/stanhu/gitlab/gdk-ee/gitlab/lib/gitlab/redis/multi_store.rb:87:in `is_a?'
/Users/stanhu/gitlab/gdk-ee/gitlab/config/environment.rb:7:in `<main>'
/Users/stanhu/.rbenv/versions/2.7.4/bin/bundle:23:in `load'
/Users/stanhu/.rbenv/versions/2.7.4/bin/bundle:23:in `<main>'

Introduced in !75258 (merged). Not sure why this wasn't caught somewhere else.

/cc: @nmilojevic1, @smcgivern