Prepare async index for p_ci_builds.project_id
What does this MR do and why?
Prepare async index for p_ci_builds.project_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
\d ci_builds "index_66150954f7" btree (project_id_convert_to_bigint, name, ref) WHERE type::text = 'Ci::Build'::text AND status::text = 'success'::text AND (retried = false OR retried IS NULL) "index_491160ecb2" btree (project_id_convert_to_bigint, status) WHERE type::text = 'Ci::Build'::text AND (status::text = ANY (ARRAY['running'::character varying::text, 'pending'::character varying::text, 'created'::character varying::text])) "index_57533f9878" btree (status, created_at, project_id_convert_to_bigint) WHERE type::text = 'Ci::Build'::text
-
Run the following commands to restore the feature flag:
RAILS_ENV=test bin/rails runner 'Feature.disable :database_async_index_operations'
Related to #422835 (closed)
Edited by Tianwen Chen