Skip to content

Remove MR opened state index synchronously

What does this MR do and why?

idx_merge_requests_on_target_project_id_and_iid_opened 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.30.41_PM

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

Database Migrations

UP
(455498-idx_merge_requests_on_target_project_id_and_iid_opened-synchronous-database-index-removal )    rake db:migrate
main: == [advisory_lock_connection] object_id: 124200, pg_backend_pid: 38214
main: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: migrating
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0142s
main: -- indexes(:merge_requests)
main:    -> 0.0109s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- remove_index(:merge_requests, {:algorithm=>:concurrently, :name=>"idx_merge_requests_on_target_project_id_and_iid_opened"})
main:    -> 0.0010s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: migrated (0.0409s)

main: == [advisory_lock_connection] object_id: 124200, pg_backend_pid: 38214
ci: == [advisory_lock_connection] object_id: 124660, pg_backend_pid: 38216
ci: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: migrating
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0011s
ci: -- indexes(:merge_requests)
ci:    -> 0.0100s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- remove_index(:merge_requests, {:algorithm=>:concurrently, :name=>"idx_merge_requests_on_target_project_id_and_iid_opened"})
ci:    -> 0.0021s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0003s
ci: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: migrated (0.0264s)
DOWN
(455498-idx_merge_requests_on_target_project_id_and_iid_opened-synchronous-database-index-removal )    rake db:migrate:down:main VERSION=20240423020601                                 [14:47 23/04]
main: == [advisory_lock_connection] object_id: 123820, pg_backend_pid: 49035
main: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: reverting
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0101s
main: -- index_exists?(:merge_requests, [:target_project_id, :iid], {:where=>"state_id = 1", :name=>"idx_merge_requests_on_target_project_id_and_iid_opened", :algorithm=>:concurrently})
main:    -> 0.0083s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- add_index(:merge_requests, [:target_project_id, :iid], {:where=>"state_id = 1", :name=>"idx_merge_requests_on_target_project_id_and_iid_opened", :algorithm=>:concurrently})
main:    -> 0.0020s
main: -- execute("RESET statement_timeout")
main:    -> 0.0003s
main: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: reverted (0.0310s)

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

(455498-idx_merge_requests_on_target_project_id_and_iid_opened-synchronous-database-index-removal )    rake db:migrate:down:ci VERSION=20240423020601                                   [14:47 23/04]
ci: == [advisory_lock_connection] object_id: 158000, pg_backend_pid: 49678
ci: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: reverting
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0123s
ci: -- index_exists?(:merge_requests, [:target_project_id, :iid], {:where=>"state_id = 1", :name=>"idx_merge_requests_on_target_project_id_and_iid_opened", :algorithm=>:concurrently})
ci:    -> 0.0092s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- add_index(:merge_requests, [:target_project_id, :iid], {:where=>"state_id = 1", :name=>"idx_merge_requests_on_target_project_id_and_iid_opened", :algorithm=>:concurrently})
ci:    -> 0.0026s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20240423020601 RemoveIdxMergeRequestsOnTargetProjectIdAndIidOpened: reverted (0.0421s)

ci: == [advisory_lock_connection] object_id: 158000, pg_backend_pid: 49678

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 #455498

Edited by Sincheol (David) Kim

Merge request reports