Skip to content

Remove temporary max seats used indices in subscription model

Aishwarya Subramanian requested to merge 350823-remove-temp-indices into master

What does this MR do and why?

This MR removes the following two indices that were temporarily introduced for a background migration:

tmp_gitlab_subscriptions_max_seats_used_migration
tmp_gitlab_subscriptions_max_seats_used_migration_2

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

Migration up:

== 20220413164146 RemoveMaxSeatsUsedIndices: migrating ========================
-- transaction_open?()
   -> 0.0000s
-- indexes(:gitlab_subscriptions)
   -> 0.0049s
-- execute("SET statement_timeout TO 0")
   -> 0.0002s
-- remove_index(:gitlab_subscriptions, {:algorithm=>:concurrently, :name=>"tmp_gitlab_subscriptions_max_seats_used_migration"})
   -> 0.0027s
-- execute("RESET statement_timeout")
   -> 0.0003s
-- transaction_open?()
   -> 0.0000s
-- indexes(:gitlab_subscriptions)
   -> 0.0015s
-- remove_index(:gitlab_subscriptions, {:algorithm=>:concurrently, :name=>"tmp_gitlab_subscriptions_max_seats_used_migration_2"})
   -> 0.0010s
== 20220413164146 RemoveMaxSeatsUsedIndices: migrated (0.0170s) ===============

Migration down:

== 20220413164146 RemoveMaxSeatsUsedIndices: reverting ========================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:gitlab_subscriptions, :id, {:where=>"start_date >= '2021-08-02' AND start_date <= '2021-11-20' AND max_seats_used != 0 AND max_seats_used > seats_in_use AND max_seats_used > seats", :name=>"tmp_gitlab_subscriptions_max_seats_used_migration", :algorithm=>:concurrently})
   -> 0.0036s
-- execute("SET statement_timeout TO 0")
   -> 0.0002s
-- add_index(:gitlab_subscriptions, :id, {:where=>"start_date >= '2021-08-02' AND start_date <= '2021-11-20' AND max_seats_used != 0 AND max_seats_used > seats_in_use AND max_seats_used > seats", :name=>"tmp_gitlab_subscriptions_max_seats_used_migration", :algorithm=>:concurrently})
   -> 0.0028s
-- execute("RESET statement_timeout")
   -> 0.0002s
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:gitlab_subscriptions, :id, {:where=>"start_date < '2021-08-02' AND max_seats_used != 0 AND max_seats_used > seats_in_use AND max_seats_used > seats", :name=>"tmp_gitlab_subscriptions_max_seats_used_migration_2", :algorithm=>:concurrently})
   -> 0.0015s
-- add_index(:gitlab_subscriptions, :id, {:where=>"start_date < '2021-08-02' AND max_seats_used != 0 AND max_seats_used > seats_in_use AND max_seats_used > seats", :name=>"tmp_gitlab_subscriptions_max_seats_used_migration_2", :algorithm=>:concurrently})
   -> 0.0012s
== 20220413164146 RemoveMaxSeatsUsedIndices: reverted (0.0166s) ===============

How to set up and validate locally

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

-NA-

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Mentions #350823 (closed)

Edited by Aishwarya Subramanian

Merge request reports