Restore fail, constraint fk_rails_43a9aa4ca8 on table remote_mirrors depends on table projects

Hi,

We are running gitlab EE 8.7.2.-ee cc48fbf omnibus istallation on Ubuntu 14.04 lte

Backup is taken by sudo gitlab-rake gitlab:backup:create

I have installed the same on another 14.04 server and made sure the correct services are turned off:

root@tosveubuntu:/var/opt/gitlab/backups# sudo gitlab-ctl status
run: gitlab-workhorse: (pid 29338) 137s; run: log: (pid 10637) 3769s
run: logrotate: (pid 29343) 137s; run: log: (pid 10655) 3761s
run: nginx: (pid 29349) 136s; run: log: (pid 10642) 3767s
run: postgresql: (pid 29043) 154s; run: log: (pid 10521) 3823s
run: redis: (pid 29045) 153s; run: log: (pid 10434) 3829s
down: sidekiq: 1514s, normally up; run: log: (pid 10626) 3775s
down: unicorn: 1531s, normally up; run: log: (pid 10594) 3777s

Upon restore I get rake aborted and ActiveRecord::StatementInvalid: PG::DependentObjectsStillExist: ERROR: cannot drop table projects because other objects depend on it
DETAIL: constraint fk_rails_43a9aa4ca8 on table remote_mirrors depends on table projects.

The issue seems to have been noticed: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4020

Do any of you have any suggestions on how to proceed?

root@tosveubuntu:/var/opt/gitlab/backups# gitlab-rake gitlab:backup:restore BACKUP=1463582126 --trace
** Invoke gitlab:backup:restore (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute gitlab:backup:restore
Unpacking backup … done
Do you want to continue (yes/no)? yes
Removing all tables. Press Ctrl-C within 5 seconds to abort
Cleaning the database …
** Invoke gitlab:db:drop_tables (first_time)
** Invoke environment
** Execute gitlab:db:drop_tables
rake aborted!
ActiveRecord::StatementInvalid: PG::DependentObjectsStillExist: ERROR: cannot drop table projects because other objects depend on it
DETAIL: constraint fk_rails_43a9aa4ca8 on table remote_mirrors depends on table projects
HINT: Use DROP … CASCADE to drop the dependent objects too.
: DROP TABLE projects
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in async_exec' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in block in execute’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in block in log' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in instrument’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in log' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in execute’
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:32:in block (4 levels) in <top (required)>' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:32:in each’
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:32:in block (3 levels) in <top (required)>' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in call’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in block in execute' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in each’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in execute' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in block in invoke_with_call_chain’
/opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in invoke_with_call_chain’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in invoke' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:49:in block (3 levels) in <top (required)>’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in call' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in block in execute’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in each' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in execute’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in block in invoke_with_call_chain' /opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in invoke_with_call_chain' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in invoke’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in invoke_task' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in block (2 levels) in top_level’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in each' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in block in top_level’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in run_with_threads' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in top_level’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in block in run' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in standard_exception_handling’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in run' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in <top (required)>’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/rake:23:in load' /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/rake:23:in
PG::DependentObjectsStillExist: ERROR: cannot drop table projects because other objects depend on it
DETAIL: constraint fk_rails_43a9aa4ca8 on table remote_mirrors depends on table projects
HINT: Use DROP … CASCADE to drop the dependent objects too.
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in async_exec' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in block in execute’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in block in log' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in instrument’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in log' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in execute’
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:32:in block (4 levels) in <top (required)>' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:32:in each’
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:32:in block (3 levels) in <top (required)>' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in call’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in block in execute' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in each’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in execute' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in block in invoke_with_call_chain’
/opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in invoke_with_call_chain’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in invoke' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:49:in block (3 levels) in <top (required)>’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in call' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in block in execute’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in each' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in execute’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in block in invoke_with_call_chain' /opt/gitlab/embedded/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in invoke_with_call_chain' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in invoke’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in invoke_task' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in block (2 levels) in top_level’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in each' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in block in top_level’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in run_with_threads' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in top_level’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in block in run' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in standard_exception_handling’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in run' /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in <top (required)>’
/opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/rake:23:in load' /opt/gitlab/embedded/service/gem/ruby/2.1.0/bin/rake:23:in
Tasks: TOP => gitlab:db:drop_tables