Skip to content

Resolve "Inconsistent schema - indexes"

Diogo Frazão requested to merge 349549-inconsistent-schema-indexes into master

What does this MR do and why?

We already have index_on_projects_path index on production, but we could not find it in structure.sql and migrations. In this MR, we are adding a new migration to add this index (if not exist).

https://thanos-query.ops.gitlab.net/graph?g0.expr=pg_stat_user_indexes_idx_scan%7Bindexrelname%3D%22index_on_projects_path%22%2C%20env%3D%22gstg%22%7D&g0.tab=0&g0.stacked=0&g0.range_input=2d&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=%5B%5D

up:

== 20220114105525 AddIndexOnProjectsPath: migrating ===========================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:projects, :path, {:name=>"index_on_projects_path", :algorithm=>:concurrently})
   -> 0.0131s
-- add_index(:projects, :path, {:name=>"index_on_projects_path", :algorithm=>:concurrently})
   -> 0.0018s
== 20220114105525 AddIndexOnProjectsPath: migrated (0.0160s) ==================

down:

== 20220114105525 AddIndexOnProjectsPath: reverting ===========================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:projects, :path, {:name=>"index_on_projects_path", :algorithm=>:concurrently})
   -> 0.0566s
-- execute("SET statement_timeout TO 0")
   -> 0.0006s
-- remove_index(:projects, {:name=>"index_on_projects_path", :algorithm=>:concurrently, :column=>:path})
   -> 0.0195s
-- execute("RESET statement_timeout")
   -> 0.0005s
== 20220114105525 AddIndexOnProjectsPath: reverted (0.0810s) ==================

Screenshots or screen recordings

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

How to set up and validate locally

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

MR acceptance checklist

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

Related to #349549 (closed)

Edited by Diogo Frazão

Merge request reports