Upgrade to 10.8.0-ce.0 fails because of AddIndexesToProjectMirrorData
Summary
I am not able to upgrade 10.7.3-ce.0 or 10.7.4-ce.0 to 10.8.0-ce.0 because the database migration AddIndexesToProjectMirrorData fails.
Steps to reproduce
Install 10.7.3 (EE), downgrade to 10.7.3 (CE), upgrade to 10.7.4 (CE) and try to upgrade to 10.8.0 (CE). [Omnibus Packages]
Example Project
N/A
What is the current bug behavior?
Database migration fails.
What is the expected correct behavior?
Database migration runs successfully.
Relevant logs and/or screenshots
== 20180503175054 AddIndexesToProjectMirrorData: migrating ====================
-- transaction_open?()
-> 0.0000s
-- execute("SET statement_timeout TO 0")
-> 0.0001s
-- index_exists?(:project_mirror_data, :jid, {:algorithm=>:concurrently})
-> 0.0010s
-- add_index(:project_mirror_data, :jid, {:algorithm=>:concurrently})
StandardError: An error has occurred, all later migrations canceled:
PG::UndefinedColumn: ERROR: column "jid" does not exist
: CREATE INDEX CONCURRENTLY "index_project_mirror_data_on_jid" ON "project_mirror_data" ("jid" )
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:142:in `add_index'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in `add_concurrent_index'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb:9:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:50: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::StatementInvalid: PG::UndefinedColumn: ERROR: column "jid" does not exist
: CREATE INDEX CONCURRENTLY "index_project_mirror_data_on_jid" ON "project_mirror_data" ("jid" )
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:142:in `add_index'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in `add_concurrent_index'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb:9:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:50: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:
PG::UndefinedColumn: ERROR: column "jid" does not exist
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:142:in `add_index'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in `add_concurrent_index'
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb:9:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:50: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)
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Current User: git Using RVM: no Ruby Version: 2.3.7p456 Gem Version: 2.6.14 Bundler Version:1.13.7 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.16.3 Sidekiq Version:5.0.5 Go Version: unknown
GitLab information Version: 10.8.0 Revision: 55e4a0b Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://example.com HTTP Clone URL: https://example.com/some-group/some-project.git SSH Clone URL: git@example.com:some-group/some-project.git Using LDAP: no Using Omniauth: no
GitLab Shell Version: 7.1.2 Repository storage paths:
- default: /var/opt/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
Checking GitLab Shell ...GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 2/1 ... ok 2/3 ... ok 3/4 ... ok 3/5 ... ok 3/6 ... repository is empty 2/7 ... ok 4/9 ... ok 2/12 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes 2/3 ... yes 3/4 ... yes 3/5 ... yes 3/6 ... yes 2/7 ... yes 4/9 ... yes 2/12 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.7) Git version >= 2.9.5 ? ... yes (2.16.3) Git user has default SSH configuration? ... yes Active users: ... 3
Checking GitLab ... Finished
Possible fixes
I would say that it fails because of the previous downgrade from EE to CE. Maybe there are some columns already created.