Skip to content

Drop old index for security ci builds on name and id parser

What does this MR do and why?

We had to recreate index for ci_builds to include apifuzzer_fuzz and apifuzzer_fuzz_dnd security jobs.

This is a third and last MR for this process according to https://docs.gitlab.com/ee/development/adding_database_indexes.html#create-indexes-asynchronously to create index synchronously as a follow up to !81586 (merged).

In this MR we are dropping old index that will be no longer used as !82047 (merged) is merged.

Migrations

⋊> env VERBOSE=true bundle exec rake db:migrate:up VERSION=20220308000205
== 20220308000205 DropOldIndexSecurityCiBuildsOnNameAndIdParserFeatures: migrating 
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds", [:name, :id], {:name=>"index_security_ci_builds_on_name_and_id_parser_features_old", :where=>"(name::text = ANY (ARRAY['container_scanning'::character varying::text,\n                                         'dast'::character varying::text,\n                                         'dependency_scanning'::character varying::text,\n                                         'license_management'::character varying::text,\n                                         'sast'::character varying::text,\n                                         'secret_detection'::character varying::text,\n                                         'coverage_fuzzing'::character varying::text,\n                                         'license_scanning'::character varying::text])\n                ) AND type::text = 'Ci::Build'::text", :algorithm=>:concurrently})
   -> 0.0107s
-- execute("SET statement_timeout TO 0")
   -> 0.0006s
-- remove_index("ci_builds", {:name=>"index_security_ci_builds_on_name_and_id_parser_features_old", :where=>"(name::text = ANY (ARRAY['container_scanning'::character varying::text,\n                                         'dast'::character varying::text,\n                                         'dependency_scanning'::character varying::text,\n                                         'license_management'::character varying::text,\n                                         'sast'::character varying::text,\n                                         'secret_detection'::character varying::text,\n                                         'coverage_fuzzing'::character varying::text,\n                                         'license_scanning'::character varying::text])\n                ) AND type::text = 'Ci::Build'::text", :algorithm=>:concurrently, :column=>[:name, :id]})
   -> 0.0151s
-- execute("RESET statement_timeout")
   -> 0.0006s
== 20220308000205 DropOldIndexSecurityCiBuildsOnNameAndIdParserFeatures: migrated (0.0289s) 
⋊> env VERBOSE=true bundle exec rake db:migrate:down VERSION=20220308000205
== 20220308000205 DropOldIndexSecurityCiBuildsOnNameAndIdParserFeatures: reverting 
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds", [:name, :id], {:name=>"index_security_ci_builds_on_name_and_id_parser_features_old", :where=>"(name::text = ANY (ARRAY['container_scanning'::character varying::text,\n                                         'dast'::character varying::text,\n                                         'dependency_scanning'::character varying::text,\n                                         'license_management'::character varying::text,\n                                         'sast'::character varying::text,\n                                         'secret_detection'::character varying::text,\n                                         'coverage_fuzzing'::character varying::text,\n                                         'license_scanning'::character varying::text])\n                ) AND type::text = 'Ci::Build'::text", :algorithm=>:concurrently})
   -> 0.0117s
-- execute("SET statement_timeout TO 0")
   -> 0.0007s
-- add_index("ci_builds", [:name, :id], {:name=>"index_security_ci_builds_on_name_and_id_parser_features_old", :where=>"(name::text = ANY (ARRAY['container_scanning'::character varying::text,\n                                         'dast'::character varying::text,\n                                         'dependency_scanning'::character varying::text,\n                                         'license_management'::character varying::text,\n                                         'sast'::character varying::text,\n                                         'secret_detection'::character varying::text,\n                                         'coverage_fuzzing'::character varying::text,\n                                         'license_scanning'::character varying::text])\n                ) AND type::text = 'Ci::Build'::text", :algorithm=>:concurrently})
   -> 0.0390s
-- execute("RESET statement_timeout")
   -> 0.0008s
== 20220308000205 DropOldIndexSecurityCiBuildsOnNameAndIdParserFeatures: reverted (0.0547s) 

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

Merge request reports

Loading