Invalid single-table inheritance type: Group is not a subclass of GenerateMissingRoutes::Namespace
Summary
Upgrading instance from 10.8.7
to 11.7
and running sudo gitlab-ctl reconfigure
throws below error:
Problematic migration: https://gitlab.com/gitlab-org/gitlab-ee/blob/11-7-stable-ee/db/migrate/20180702134423_generate_missing_routes.rb
ZD: https://gitlab.zendesk.com/agent/tickets/115514
Initially, upgrade failed with the Prometheus error, but was fixed (issue with symlink) and GitLab server was rebuilt and restored from the backup database dump, but its failing now with this on the reconfigure step:
== 20180626125654 AddIndexOnDeployableForDeployments: migrating ===============
-- transaction_open?()
-> 0.0000s
-- index_name(:deployments, {:column=>["deployable_type", "deployable_id"]})
-> 0.0000s
-- index_exists?(:deployments, [:deployable_type, :deployable_id], {:algorithm=>:concurrently, :name=>"index_deployments_on_deployable_type_and_deployable_id"})
-> 0.0151s
-- execute("SET statement_timeout TO 0")
-> 0.0025s
-- add_index(:deployments, [:deployable_type, :deployable_id], {:algorithm=>:concurrently, :name=>"index_deployments_on_deployable_type_and_deployable_id"})
-> 0.0138s
-- execute("RESET ALL")
-> 0.0026s
== 20180626125654 AddIndexOnDeployableForDeployments: migrated (0.0343s) ======
== 20180626171125 AddFeatureFlagsToProjects: migrating ========================
-- create_table(:operations_feature_flags, {:id=>:bigserial})
-> 0.0383s
-- create_table(:operations_feature_flags_clients, {:id=>:bigserial})
-> 0.0793s
== 20180626171125 AddFeatureFlagsToProjects: migrated (0.1179s) ===============rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Invalid single-table inheritance type: Group is not a subclass of GenerateMissingRoutes::Namespace
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:35:in `build_full_name'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:56:in `attributes_for_insert'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:133:in `block (2 levels) in up'
/opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/each_batch.rb:90:in `block in each_batch'
/opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/each_batch.rb:68:in `step'
/opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/each_batch.rb:68:in `each_batch'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:132:in `block in up'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:131:in `each'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:131:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:52:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Caused by:
ActiveRecord::SubclassNotFound: Invalid single-table inheritance type: Group is not a subclass of GenerateMissingRoutes::Namespace
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:35:in `build_full_name'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:56:in `attributes_for_insert'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:133:in `block (2 levels) in up'
/opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/each_batch.rb:90:in `block in each_batch'
/opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/each_batch.rb:68:in `step'
/opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/each_batch.rb:68:in `each_batch'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:132:in `block in up'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:131:in `each'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180702134423_generate_missing_routes.rb:131:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:52:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20180628124813 AlterWebHookLogsIndexes: migrating ==========================
-- transaction_open?()
-> 0.0000s
-- index_name(:web_hook_logs, {:column=>["created_at", "web_hook_id"]})
-> 0.0000s
What is the current bug behavior?
DB Migrations fail with error Invalid single-table inheritance type: Group is not a subclass of GenerateMissingRoutes::Namespace
Results of GitLab environment info
Expand for output related to GitLab environment info
gitlab-rake gitlab:env:info
System information
System: Ubuntu 16.04
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.5.3p105
Gem Version: 2.7.6
Bundler Version:1.16.6
Rake Version: 12.3.2
Redis Version: 3.2.12
Git Version: 2.18.1
Sidekiq Version:5.2.3
Go Version: unknown
GitLab information
Version: 11.7.0-ee
Revision: c02f0d4
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.9
URL:
HTTP Clone URL:
SSH Clone URL:
Elasticsearch: no
Geo: no
Using LDAP: yes
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 8.4.4
Repository storage paths:
default: /mnt/nfs/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)