Skip to content

Fix Service ping failing metrics for manage stage

What does this MR do and why?

As described in #344259 (closed), import items are failing.

The dates in the description of that issue line up with when those queries were changed from distinct_count to count in !51495 (diffs)

Current hypothesis then fits and explains why we are making the change and why we think it will resolve the issue.

Migration Output
❯ be rails db:migrate
== 20211115151704 AddIndexOnProjectsImportTypeId: migrating ===================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:projects, [:import_type, :id], {:where=>"import_type IS NOT NULL", :name=>"index_imported_projects_on_import_type_id", :algorithm=>:concurrently})
   -> 0.0277s
-- execute("SET statement_timeout TO 0")
   -> 0.0010s
-- add_index(:projects, [:import_type, :id], {:where=>"import_type IS NOT NULL", :name=>"index_imported_projects_on_import_type_id", :algorithm=>:concurrently})
   -> 0.0118s
-- execute("RESET statement_timeout")
   -> 0.0008s
== 20211115151704 AddIndexOnProjectsImportTypeId: migrated (0.0441s) ==========

❯ be rails db:rollback
== 20211115151704 AddIndexOnProjectsImportTypeId: reverting ===================
-- transaction_open?()
   -> 0.0000s
-- indexes(:projects)
   -> 0.0173s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- remove_index(:projects, {:algorithm=>:concurrently, :name=>"index_imported_projects_on_import_type_id"})
   -> 0.0041s
-- execute("RESET statement_timeout")
   -> 0.0005s
== 20211115151704 AddIndexOnProjectsImportTypeId: reverted (0.0242s) ==========

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

Edited by Doug Stull

Merge request reports

Loading