Skip to content

Remove tmp_index_issues_on_issue_type_and_id_only_incidents index

Mario Celi requested to merge 408881-remove-index into master

What does this MR do and why?

BackfillWorkItemTypeIdForIssues background migration finished running for incidents in 16.0. Now we need to ensure it is finished and remove the temp index that was introduced to improve the performance of the migration

Migration output

UP

bin/rails db:migrate
main: == [advisory_lock_connection] object_id: 275640, pg_backend_pid: 76496
main: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: migrating =====
main: -- transaction_open?()
main:    -> 0.0000s
main: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: migrated (0.0712s)

main: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: migrating
main: -- transaction_open?()
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0010s
main: -- indexes(:issues)
main:    -> 0.0262s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0004s
main: -- remove_index(:issues, {:algorithm=>:concurrently, :name=>"tmp_index_issues_on_issue_type_and_id_only_incidents"})
main:    -> 0.0036s
main: -- execute("RESET statement_timeout")
main:    -> 0.0004s
main: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: migrated (0.0495s)

main: == [advisory_lock_connection] object_id: 275640, pg_backend_pid: 76496
ci: == [advisory_lock_connection] object_id: 276020, pg_backend_pid: 76498
ci: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: migrating =====
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_shared, :gitlab_internal].
ci: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: migrated (0.0142s)

ci: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: migrating
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0012s
ci: -- indexes(:issues)
ci:    -> 0.0294s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0006s
ci: -- remove_index(:issues, {:algorithm=>:concurrently, :name=>"tmp_index_issues_on_issue_type_and_id_only_incidents"})
ci:    -> 0.0057s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0005s
ci: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: migrated (0.0615s)

ci: == [advisory_lock_connection] object_id: 276020, pg_backend_pid: 76498

DOWN

bin/rails db:rollback:main db:rollback:ci STEP=2
main: == [advisory_lock_connection] object_id: 275460, pg_backend_pid: 75298
main: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: reverting
main: -- transaction_open?()
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.2025s
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.0326s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0005s
main: -- add_index(:issues, [:issue_type, :id], {:name=>"tmp_index_issues_on_issue_type_and_id_only_incidents", :where=>"issue_type = 1", :algorithm=>:concurrently})
main:    -> 0.0108s
main: -- execute("RESET statement_timeout")
main:    -> 0.0011s
main: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: reverted (0.2715s)

main: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: reverting =====
main: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: reverted (0.0060s)

main: == [advisory_lock_connection] object_id: 275460, pg_backend_pid: 75298
ci: == [advisory_lock_connection] object_id: 312200, pg_backend_pid: 75545
ci: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: reverting
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0011s
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.0343s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0005s
ci: -- add_index(:issues, [:issue_type, :id], {:name=>"tmp_index_issues_on_issue_type_and_id_only_incidents", :where=>"issue_type = 1", :algorithm=>:concurrently})
ci:    -> 0.0049s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0004s
ci: == 20230522225610 RemoveTmpIndexIssuesOnIssueTypeAndIdOnlyIncidents: reverted (0.0679s)

ci: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: reverting =====
ci: -- The migration is skipped since it modifies the schemas: [:gitlab_main].
ci: -- This database can only apply migrations in one of the following schemas: [:gitlab_ci, :gitlab_shared, :gitlab_internal].
ci: == 20230522220709 EnsureIncidentWorkItemTypeBackfillIsFinished: reverted (0.0132s)

ci: == [advisory_lock_connection] object_id: 312200, pg_backend_pid: 75545

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 #408881 (closed)

Edited by Mario Celi

Merge request reports