Transferring projects is performed synchronously
Summary
Project transfers are performed synchronously in Unicorn, rather than being backgrounded in sidekiq. Since this involves a number of mv
commands, as well as database updates, this scales poorly and is prone to errors. This particularly came to light via https://gitlab.com/gitlab-com/support-forum/issues/2036
Of particular note is that a large number of mv
commands happen while holding open a database transaction.
Steps to reproduce
Transfer a project between namespaces
What is the current bug behavior?
File moves done in unicorn
What is the expected correct behavior?
File moves done in sidekiq
Possible fixes
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/controllers/projects_controller.rb#L68
Wrap this (and the equivalent admin action) in a ProjectTransferWorker
.
Alternatively, we could do the database synchronously and just enqueue the file moves asynchronously.
It's worth noting that the rollback logic in this service is incomplete, too.