Remove TMP index in emails table
What does this MR do?
This MR removes a temporary index in the emails
table. The index was introduced for a security background MR which was executed about 6 months ago.
Related file: db/post_migrate/20200615111857_unconfirm_wrongfully_verified_emails.rb
Migrations
UP:
== 20210106153021 DropTmpIndexOnEmails: migrating =============================
-- transaction_open?()
-> 0.0001s
-- indexes(:emails)
-> 0.0033s
-- execute("SET statement_timeout TO 0")
-> 0.0001s
-- remove_index(:emails, {:algorithm=>:concurrently, :name=>"tmp_index_for_email_unconfirmation_migration"})
-> 0.0028s
-- execute("RESET ALL")
-> 0.0002s
== 20210106153021 DropTmpIndexOnEmails: migrated (0.0090s) ====================
DOWN:
== 20210106153021 DropTmpIndexOnEmails: reverting =============================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:emails, :id, {:where=>"confirmed_at IS NOT NULL", :name=>"tmp_index_for_email_unconfirmation_migration", :algorithm=>:concurrently})
-> 0.0021s
-- execute("SET statement_timeout TO 0")
-> 0.0001s
-- add_index(:emails, :id, {:where=>"confirmed_at IS NOT NULL", :name=>"tmp_index_for_email_unconfirmation_migration", :algorithm=>:concurrently})
-> 0.0163s
-- execute("RESET ALL")
-> 0.0004s
== 20210106153021 DropTmpIndexOnEmails: reverted (0.0193s) ====================
The index is not in use:
schemaname | tablename | indexname | num_rows | table_size | index_size | unique | number_of_scans | tuples_read | tuples_fetched
------------+-----------+----------------------------------------------+----------+------------+------------+--------+-----------------+-------------+----------------
public | emails | tmp_index_for_email_unconfirmation_migration | 429979 | 47 MB | 4776 kB | N | 0 | 0 | 0
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Adam Hegyi