Skip to content

Remove temp index from members table

Vijay Hawoldar requested to merge vij-remove-temp-index-user-caps into master

What does this MR do and why?

Removes the temp index tmp_index_members_on_state which was added in 14.7 and can now be removed.

The temporary index was added as part of !77298 (merged), although the migration file itself was removed/squashed in b7fbcab8.

Refs https://gitlab.com/gitlab-org/gitlab/-/issues/349960

Database info

migrate up
bin/rails db:migrate

main: == [advisory_lock_connection] object_id: 183000, pg_backend_pid: 75918
main: == 20231222114515 RemoveTmpIndexMembersOnState: migrating =====================
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0926s
main: -- indexes(:members)
main:    -> 0.0076s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- remove_index(:members, {:algorithm=>:concurrently, :name=>"tmp_index_members_on_state"})
main:    -> 0.0034s
main: -- execute("RESET statement_timeout")
main:    -> 0.0005s
main: == 20231222114515 RemoveTmpIndexMembersOnState: migrated (0.1189s) ============

main: == [advisory_lock_connection] object_id: 183000, pg_backend_pid: 75918
ci: == [advisory_lock_connection] object_id: 183220, pg_backend_pid: 75921
ci: == 20231222114515 RemoveTmpIndexMembersOnState: migrating =====================
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0006s
ci: -- indexes(:members)
ci:    -> 0.0091s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0005s
ci: -- remove_index(:members, {:algorithm=>:concurrently, :name=>"tmp_index_members_on_state"})
ci:    -> 0.0036s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20231222114515 RemoveTmpIndexMembersOnState: migrated (0.0289s) ============
migrate down
bin/rails db:rollback:main
WARNING: This version of GitLab depends on gitlab-shell 14.32.0, but you're running 14.30.0. Please update gitlab-shell.
main: == [advisory_lock_connection] object_id: 182720, pg_backend_pid: 80499
main: == 20231222114515 RemoveTmpIndexMembersOnState: reverting =====================
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0848s
main: -- index_exists?(:members, :state, {:name=>"tmp_index_members_on_state", :where=>"state = 2", :algorithm=>:concurrently})
main:    -> 0.0071s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- add_index(:members, :state, {:name=>"tmp_index_members_on_state", :where=>"state = 2", :algorithm=>:concurrently})
main:    -> 0.0043s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20231222114515 RemoveTmpIndexMembersOnState: reverted (0.1099s) ============

main: == [advisory_lock_connection] object_id: 182720, pg_backend_pid: 80499

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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Vijay Hawoldar

Merge request reports