Prepare async index for p_ci_builds.upstream_pipeline_id and commit_id
What does this MR do and why?
Prepare async index for p_ci_builds.upstream_pipeline_id and commit_id
As titled, this is the first step of creating indexes asynchronously. See guideline at https://docs.gitlab.com/ee/development/database/adding_database_indexes.html#schedule-the-index-to-be-created
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
-
Run the following commands:
./scripts/regenerate-schema RAILS_ENV=test bin/rails runner 'Feature.enable :database_async_index_operations' RAILS_ENV=test bin/rake gitlab:db:execute_async_index_operations:all
-
Confirm the following indexes are created in TEST environment
psql gitlabhq_test -h $PATH_TO_POSTGRESQL/gitlab-development-kit/postgresql
"index_357cc39ca4" btree (commit_id_convert_to_bigint, artifacts_expire_at, id) WHERE type::text = 'Ci::Build'::text AND (retried = false OR retried IS NULL) AND (name::text = ANY (ARRAY['sast'::character varying::text, 'secret_detection'::character varying::text, 'dependency_scanning'::character varying::text, 'container_scanning'::character varying::text, 'dast'::character varying::text])) "index_89477d6012" btree (upstream_pipeline_id_convert_to_bigint) WHERE upstream_pipeline_id_convert_to_bigint IS NOT NULL "index_fc42f73fa6" btree (commit_id_convert_to_bigint, type, ref)
-
Run the following commands to restore the feature flag:
RAILS_ENV=test bin/rails runner 'Feature.disable :database_async_index_operations'
Numbered steps to set up and validate the change are strongly suggested.
Related to #422835 (closed)