Skip to content

Remove a MR index with state_id, iid synchronously

What does this MR do and why?

index_merge_requests_on_target_project_id_and_iid_and_state_id index has already been removed asynchronously on GitLab.com and needs to be also ran for other installations synchronously.

Verification that the index has been removed from Gitlab.com

Screenshot_2024-04-23_at_2.38.12_PM

It would've printed out the detail of the index instead if it existed.

Database Migrations

UP
(454262-index_merge_requests_on_target_project_id_and_iid_and_state_id-synchronous-database-index )    rake db:migrate                                                                  [14:38 23/04]
main: == [advisory_lock_connection] object_id: 129020, pg_backend_pid: 44450
main: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: migrating
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0136s
main: -- indexes(:merge_requests)
main:    -> 0.0101s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- remove_index(:merge_requests, {:algorithm=>:concurrently, :name=>"index_merge_requests_on_target_project_id_and_iid_and_state_id"})
main:    -> 0.0020s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: migrated (0.0383s)

main: == [advisory_lock_connection] object_id: 129020, pg_backend_pid: 44450
ci: == [advisory_lock_connection] object_id: 129460, pg_backend_pid: 44452
ci: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: migrating
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0005s
ci: -- indexes(:merge_requests)
ci:    -> 0.0087s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0002s
ci: -- remove_index(:merge_requests, {:algorithm=>:concurrently, :name=>"index_merge_requests_on_target_project_id_and_iid_and_state_id"})
ci:    -> 0.0022s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: migrated (0.0232s)

ci: == [advisory_lock_connection] object_id: 129460, pg_backend_pid: 44452
DOWN
(454262-index_merge_requests_on_target_project_id_and_iid_and_state_id-synchronous-database-index)    rake db:migrate:down:ci VERSION=20240423024034                                     [14:37 23/04]
ci: == [advisory_lock_connection] object_id: 130000, pg_backend_pid: 43073
ci: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: reverting
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0129s
ci: -- index_exists?(:merge_requests, [:target_project_id, :iid, :state_id], {:name=>"index_merge_requests_on_target_project_id_and_iid_and_state_id", :algorithm=>:concurrently})
ci:    -> 0.0091s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0002s
ci: -- add_index(:merge_requests, [:target_project_id, :iid, :state_id], {:name=>"index_merge_requests_on_target_project_id_and_iid_and_state_id", :algorithm=>:concurrently})
ci:    -> 0.0023s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0003s
ci: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: reverted (0.0421s)

ci: == [advisory_lock_connection] object_id: 130000, pg_backend_pid: 43073

(454262-index_merge_requests_on_target_project_id_and_iid_and_state_id-synchronous-database-index )    rake db:migrate:down:main VERSION=20240423024034                                 [14:38 23/04]
main: == [advisory_lock_connection] object_id: 123820, pg_backend_pid: 43749
main: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: reverting
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0129s
main: -- index_exists?(:merge_requests, [:target_project_id, :iid, :state_id], {:name=>"index_merge_requests_on_target_project_id_and_iid_and_state_id", :algorithm=>:concurrently})
main:    -> 0.0091s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- add_index(:merge_requests, [:target_project_id, :iid, :state_id], {:name=>"index_merge_requests_on_target_project_id_and_iid_and_state_id", :algorithm=>:concurrently})
main:    -> 0.0022s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20240423024034 DropIndexMergeRequestsOnTargetProjectIdAndIidAndStateId: reverted (0.0367s)

main: == [advisory_lock_connection] object_id: 123820, pg_backend_pid: 43749

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #454262

Edited by Sincheol (David) Kim

Merge request reports