12.8.x 12.9.x regression: Cannot install from source, database setup fails: relation "features" does not exist
Summary
Install from source broken since 12.8.x, gitlab:setup
rake task fails.
Steps to reproduce
Install from source, follow installation guide, try to run the gitlab:setup
rake task.
What is the current bug behavior?
$ bundle exec rake gitlab:setup RAILS_ENV=production
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "features" does not exist
LINE 8: WHERE a.attrelid = '"features"'::regclass
What is the expected correct behavior?
Database setup completes successfully, as on 12.7.x and older.
Relevant logs and/or screenshots
Full command output:
$ bundle exec rake gitlab:setup RAILS_ENV=production
rake aborted!
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "features" does not exist
LINE 8: WHERE a.attrelid = '"features"'::regclass
^
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `exec'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `block (2 levels) in query'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `block in query'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:718:in `block (2 levels) in log'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:717:in `block in log'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:708:in `log'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `query'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:817:in `column_definitions'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:490:in `load_schema!'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/attributes.rb:247:in `load_schema!'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/attribute_decorators.rb:51:in `load_schema!'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:480:in `block in load_schema'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:477:in `load_schema'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:352:in `columns_hash'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/inheritance.rb:82:in `descends_from_active_record?'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/inheritance.rb:88:in `finder_needs_type_condition?'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/core.rb:298:in `relation'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/scoping/named.rb:57:in `default_scoped'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/scoping/named.rb:45:in `all'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/querying.rb:21:in `pluck'
/var/opt/gitlab/gitlab/lib/feature.rb:15:in `feature_names'
/var/opt/gitlab/gitlab/lib/feature.rb:42:in `block in persisted_names'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:331:in `block in fetch'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:716:in `block in save_block_result_to_cache'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:685:in `block in instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/notifications.rb:182:in `instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:685:in `instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:715:in `save_block_result_to_cache'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:331:in `fetch'
/var/opt/gitlab/gitlab/lib/feature.rb:41:in `persisted_names'
/var/opt/gitlab/gitlab/lib/feature/gitaly.rb:17:in `server_feature_flags'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:236:in `request_kwargs'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:165:in `execute'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:146:in `block in call'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:174:in `measure_timings'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:145:in `call'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client/server_service.rb:14:in `info'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:10:in `block in check_gitaly_connection'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:9:in `each'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:9:in `check_gitaly_connection'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:4:in `block (2 levels) in <top (required)>'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
Caused by:
PG::UndefinedTable: ERROR: relation "features" does not exist
LINE 8: WHERE a.attrelid = '"features"'::regclass
^
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `exec'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `block (2 levels) in query'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `block in query'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:718:in `block (2 levels) in log'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:717:in `block in log'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:708:in `log'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `query'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:817:in `column_definitions'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:490:in `load_schema!'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/attributes.rb:247:in `load_schema!'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/attribute_decorators.rb:51:in `load_schema!'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:480:in `block in load_schema'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:477:in `load_schema'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/model_schema.rb:352:in `columns_hash'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/inheritance.rb:82:in `descends_from_active_record?'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/inheritance.rb:88:in `finder_needs_type_condition?'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/core.rb:298:in `relation'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/scoping/named.rb:57:in `default_scoped'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/scoping/named.rb:45:in `all'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2/lib/active_record/querying.rb:21:in `pluck'
/var/opt/gitlab/gitlab/lib/feature.rb:15:in `feature_names'
/var/opt/gitlab/gitlab/lib/feature.rb:42:in `block in persisted_names'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:331:in `block in fetch'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:716:in `block in save_block_result_to_cache'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:685:in `block in instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/notifications.rb:182:in `instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:685:in `instrument'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:715:in `save_block_result_to_cache'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2/lib/active_support/cache.rb:331:in `fetch'
/var/opt/gitlab/gitlab/lib/feature.rb:41:in `persisted_names'
/var/opt/gitlab/gitlab/lib/feature/gitaly.rb:17:in `server_feature_flags'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:236:in `request_kwargs'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:165:in `execute'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:146:in `block in call'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:174:in `measure_timings'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client.rb:145:in `call'
/var/opt/gitlab/gitlab/lib/gitlab/gitaly_client/server_service.rb:14:in `info'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:10:in `block in check_gitaly_connection'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:9:in `each'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:9:in `check_gitaly_connection'
/var/opt/gitlab/gitlab/lib/tasks/gitlab/setup.rake:4:in `block (2 levels) in <top (required)>'
/var/opt/gitlab/gitlab/vendor/bundle/ruby/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
Tasks: TOP => gitlab:setup
Possible fixes
N/A
Labels
This should be ~bug regression:12.8 ~P2 ~S2 presumably. The "workaround" is installing 12.7.x or older and then upgrading, or #22832 (comment 215169148) as posted by @stanhu below.
Edited by Melvin Vermeeren