Creation of merge_request_diff_commits table and related indices times out when restoring from backup
Summary
The merge_request_diff_commits
table and related indices are not created when restoring a backup.
This is on a large instance with ~220+k MRs and 170+mm rows on merge_request_diff_commits
.
Customer is able to work around the problem by temporarily setting the PG statement_time to 0.
Steps to reproduce
- On a very large instance, take a backup using
gitlab-rake gitlab:backup:create SKIP=uploads,repositories,builds,artifacts,artifacts,lfs,registry,pages
- Perform a
gitlab-rake gitlab:restore
using this backup - Errors on
index_merge_request_diff_commits_on_mr_diff_id_and_order
,index_merge_request_diff_commits_on_sha
, andmerge_request_diff_commits
will be thrown.
What is the current bug behavior?
The restore completes, but the merge_request_diff_commits
table is not created
What is the expected correct behavior?
All tables are created
Relevant logs and/or screenshots
CREATE UNIQUE INDEX index_merge_request_diff_commits_on_mr_diff_id_and_order ON public.merge_request_diff_commits USING btree (merge_request_diff_id, relative_order);
ERROR: canceling statement due to statement timeout
Output of checks
Results of GitLab environment info
This is on a large instance with 3 rails nodes, pgbouncer, and 3 pg nodes.
Expand for output related to GitLab environment info
11.4.7-ee (d610354)
Possible fixes
Changes in https://gitlab.com/gitlab-org/gitlab-ce/issues/57915 may resolve this.
https://gitlab.com/gitlab-org/gitlab-ce/issues/58142 may make it more convenient to work around this problem.
/cc @DouweM