Skip to content

Prepare async index creation. Temp issue_type for incidents index

Mario Celi requested to merge 403158-async-index-creation into master

What does this MR do and why?

In !117728 (merged) we are going to fix issues of type incident. The background migration requires a temp index to be created. Index creation took 40 minutes in DBLab so we need to create it over the weekend as described in https://docs.gitlab.com/ee/development/database/query_performance.html#timing-guidelines-for-queries

DB review

UP

bin/rails db:migrate
main: == [advisory_lock_connection] object_id: 274420, pg_backend_pid: 77160
main: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: migrating ========
main: -- index_exists?(:issues, [:issue_type, :id], {:name=>"tmp_index_issues_on_issue_type_and_id_only_incidents", :where=>"issue_type = 1", :algorithm=>:concurrently})
main:    -> 0.0278s
main: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: migrated (0.2323s)

main: == [advisory_lock_connection] object_id: 274420, pg_backend_pid: 77160
ci: == [advisory_lock_connection] object_id: 274660, pg_backend_pid: 77163
ci: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: migrating ========
ci: -- index_exists?(:issues, [:issue_type, :id], {:name=>"tmp_index_issues_on_issue_type_and_id_only_incidents", :where=>"issue_type = 1", :algorithm=>:concurrently})
ci:    -> 0.0311s
ci: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: migrated (0.0525s)

ci: == [advisory_lock_connection] object_id: 274660, pg_backend_pid: 77163

DOWN

bin/rails db:migrate:down:main db:migrate:down:ci VERSION=20230414140202
main: == [advisory_lock_connection] object_id: 274180, pg_backend_pid: 79113
main: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: reverting ========
main: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: reverted (0.1262s)

main: == [advisory_lock_connection] object_id: 274180, pg_backend_pid: 79113
ci: == [advisory_lock_connection] object_id: 279760, pg_backend_pid: 79366
ci: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: reverting ========
ci: == 20230414140202 AddIssuesIncidentTypeTempIndexAsyncDotCom: reverted (0.0589s)

ci: == [advisory_lock_connection] object_id: 279760, pg_backend_pid: 79366

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #403158 (closed)

Edited by Mario Celi

Merge request reports

Loading