Skip to content

Create index_issues_on_namespace_id_iid_unique index [SYNC]

What does this MR do and why?

The index index_issues_on_namespace_id_iid_unique was already created on Gitlab.com async over the weekend as part of !139827 (merged). This migration creates it sync for self-hosted

Migration output

UP
main: == [advisory_lock_connection] object_id: 183240, pg_backend_pid: 91319
main: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: migrating ===============
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0005s
main: -- index_exists?(:issues, [:namespace_id, :iid], {:name=>"index_issues_on_namespace_id_iid_unique", :unique=>true, :algorithm=>:concurrently})
main:    -> 0.0100s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- add_index(:issues, [:namespace_id, :iid], {:name=>"index_issues_on_namespace_id_iid_unique", :unique=>true, :algorithm=>:concurrently})
main:    -> 0.0020s
main: -- execute("RESET statement_timeout")
main:    -> 0.0001s
main: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: migrated (0.0238s) ======

main: == [advisory_lock_connection] object_id: 183240, pg_backend_pid: 91319
ci: == [advisory_lock_connection] object_id: 183380, pg_backend_pid: 91321
ci: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: migrating ===============
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0004s
ci: -- index_exists?(:issues, [:namespace_id, :iid], {:name=>"index_issues_on_namespace_id_iid_unique", :unique=>true, :algorithm=>:concurrently})
ci:    -> 0.0111s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- add_index(:issues, [:namespace_id, :iid], {:name=>"index_issues_on_namespace_id_iid_unique", :unique=>true, :algorithm=>:concurrently})
ci:    -> 0.0041s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: migrated (0.0271s) ======

ci: == [advisory_lock_connection] object_id: 183380, pg_backend_pid: 91321

main: == [advisory_lock_connection] object_id: 182720, pg_backend_pid: 9006
main: == 20231207221418 DropNamespaceIdIndexOnIssues: migrating =====================
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0786s
main: -- indexes(:issues)
main:    -> 0.0102s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- remove_index(:issues, {:algorithm=>:concurrently, :name=>"index_issues_on_namespace_id"})
main:    -> 0.0016s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20231207221418 DropNamespaceIdIndexOnIssues: migrated (0.1021s) ============

main: == [advisory_lock_connection] object_id: 182720, pg_backend_pid: 9006
ci: == [advisory_lock_connection] object_id: 182940, pg_backend_pid: 9008
ci: == 20231207221418 DropNamespaceIdIndexOnIssues: migrating =====================
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0005s
ci: -- indexes(:issues)
ci:    -> 0.0107s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- remove_index(:issues, {:algorithm=>:concurrently, :name=>"index_issues_on_namespace_id"})
ci:    -> 0.0016s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20231207221418 DropNamespaceIdIndexOnIssues: migrated (0.0233s) ============

ci: == [advisory_lock_connection] object_id: 182940, pg_backend_pid: 9008
DOWN
bin/rails db:migrate:down:main db:migrate:down:ci VERSION=20231207221418
main: == [advisory_lock_connection] object_id: 181400, pg_backend_pid: 8071
main: == 20231207221418 DropNamespaceIdIndexOnIssues: reverting =====================
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0788s
main: -- index_exists?(:issues, :namespace_id, {:name=>"index_issues_on_namespace_id", :algorithm=>:concurrently})
main:    -> 0.0075s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- add_index(:issues, :namespace_id, {:name=>"index_issues_on_namespace_id", :algorithm=>:concurrently})
main:    -> 0.0047s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20231207221418 DropNamespaceIdIndexOnIssues: reverted (0.1013s) ============

main: == [advisory_lock_connection] object_id: 181400, pg_backend_pid: 8071
ci: == [advisory_lock_connection] object_id: 216300, pg_backend_pid: 8329
ci: == 20231207221418 DropNamespaceIdIndexOnIssues: reverting =====================
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0004s
ci: -- index_exists?(:issues, :namespace_id, {:name=>"index_issues_on_namespace_id", :algorithm=>:concurrently})
ci:    -> 0.0108s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0002s
ci: -- add_index(:issues, :namespace_id, {:name=>"index_issues_on_namespace_id", :algorithm=>:concurrently})
ci:    -> 0.0035s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20231207221418 DropNamespaceIdIndexOnIssues: reverted (0.0271s) ============

ci: == [advisory_lock_connection] object_id: 216300, pg_backend_pid: 8329

bin/rails db:migrate:down:main db:migrate:down:ci VERSION=20231207211418
main: == [advisory_lock_connection] object_id: 182340, pg_backend_pid: 89736
main: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: reverting ===============
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0896s
main: -- indexes(:issues)
main:    -> 0.0078s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0001s
main: -- remove_index(:issues, {:algorithm=>:concurrently, :name=>"index_issues_on_namespace_id_iid_unique"})
main:    -> 0.0009s
main: -- execute("RESET statement_timeout")
main:    -> 0.0001s
main: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: reverted (0.1080s) ======

main: == [advisory_lock_connection] object_id: 182340, pg_backend_pid: 89736
ci: == [advisory_lock_connection] object_id: 216900, pg_backend_pid: 90000
ci: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: reverting ===============
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0007s
ci: -- indexes(:issues)
ci:    -> 0.0154s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0002s
ci: -- remove_index(:issues, {:algorithm=>:concurrently, :name=>"index_issues_on_namespace_id_iid_unique"})
ci:    -> 0.0021s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20231207211418 AddIidNamespaceUniqueIndexToIssues: reverted (0.0328s) ======

ci: == [advisory_lock_connection] object_id: 216900, pg_backend_pid: 90000

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

Edited by Alexandru Croitor

Merge request reports

Loading