Removing projects is incredibly slow
When removing projects with a lot of associated data (e.g. issues) the jobs can take forever. This is because for all Project associations we use dependent: :destroy
instead of dependent: :delete
. Using #destroy
for removals really doesn't work when a project has e.g. 10 000 issues. Today I had to manually remove issues for a whole bunch of projects pending removal since the jobs would not complete. Upon closer inspection I noticed all of these projects had at least 10 000 issues each).
MR https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6292 aims to use foreign keys for removals, making the process much faster. However, adding all these foreign keys can take considerable amounts of time. Using https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9069 means we at least don't need downtime, but it can still take forever.
As such we need to do two things:
- Try to adjust the foreign key MR so we can complete it in 15-20 miuntes, without downtime
- If that doesn't work use
dependent: :delete
for the time being while we try to figure out how to make step 1 work (we need the foreign keys to combat orphaned data)