Migration PopulateCanPushFromDeployKeysProjects failing on MySQL environments
Summary
The migration PopulateCanPushFromDeployKeysProjects, which was included as of public release v10.3.4 is failing to run successfully in MySQL Environments.
Steps to reproduce
From an installation of Gitlab CE v10.3.3, attempt to upgrade to v10.3.4 — upon the DB migration stage, an error is thrown during the migration attempt indicating the migration failed to complete
What is the current bug behavior?
The migration is not completed successfully in MySQL Environments
What is the expected correct behavior?
The migration is expected to complete successfully in MySQL Environments
Relevant logs and/or screenshots
bundle exec rake db:migrate RAILS_ENV=production
== 20171215113714 PopulateCanPushFromDeployKeysProjects: migrating ============
-- execute(" UPDATE deploy_keys_projects\n SET can_push = keys.can_push\n FROM keys\n WHERE deploy_key_id = keys.id\n AND deploy_keys_projects.id BETWEEN 1 AND 50\n")
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM keys
WHERE deploy_key_id = keys.id
AND deploy_keys_projects' at line 3: UPDATE deploy_keys_projects
SET can_push = keys.can_push
FROM keys
WHERE deploy_key_id = keys.id
AND deploy_keys_projects.id BETWEEN 1 AND 50
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in `_query'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.5/lib/mysql2/client.rb:120:in `block in query'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in `handle_interrupt'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/mysql2-0.4.5/lib/mysql2/client.rb:119:in `query'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/peek-mysql2-1.1.0/lib/peek/views/mysql2.rb:14:in `query_with_timing'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:317:in `block in execute'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:317:in `execute'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/mysql2_adapter.rb:217:in `execute'
/home/git/gitlab/config/initializers/connection_fix.rb:20:in `execute'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:665:in `block in method_missing'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:634:in `block in say_with_time'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:634:in `say_with_time'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:654:in `method_missing'
/home/git/gitlab/db/migrate/20171215113714_populate_can_push_from_deploy_keys_projects.rb:21:in `block in up'
/home/git/gitlab/app/models/concerns/each_batch.rb:75:in `block in each_batch'
/home/git/gitlab/app/models/concerns/each_batch.rb:56:in `step'
/home/git/gitlab/app/models/concerns/each_batch.rb:56:in `each_batch'
/home/git/gitlab/db/migrate/20171215113714_populate_can_push_from_deploy_keys_projects.rb:18:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:611:in `exec_migration'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:591:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:590:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:768:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:1023:in `block in execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:1071:in `ddl_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:1022:in `execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:984:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:980:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:980:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:823:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:801:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/tasks/database_tasks.rb:139:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Results of GitLab environment info
bundle exec rake gitlab:env:info RAILS_ENV=production
System information System: Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.5.2.2 Bundler Version:1.16.0 Rake Version: 12.3.0 Redis Version: 4.0.6 Git Version: 2.14.1 Sidekiq Version:5.0.4 Go Version: go1.8.3 linux/amd64
GitLab information Version: 10.3.4 Revision: 56dc7222 Directory: /home/git/gitlab DB Adapter: mysql2
GitLab Shell Version: 5.10.2
Possible fixes
The MySQL update Syntax does not allow for the "FROM" keyword in an UPDATE statement