Prepare async index removal of token for ci_builds

What does this MR do and why?

As titled, prepare the async index removal of index_ci_builds_on_token_encrypted for ci_builds.

Because index_ci_builds_on_token_encrypted will be replaced with unique_ci_builds_token_encrypted_and_partition_id to help with the partition for ci_builds

How to set up and validate locally

  1. Verify the index does exist

    gitlabhq_development=# \di+ index_ci_builds_on_token_encrypted;
                                       List of relations
    Schema |             Name             | Type  |  Owner   |   Table   | Size  | Description
    --------+------------------------------+-------+----------+-----------+-------+-------------
    public | index_ci_builds_on_token_encrypted | index | joe_1565 | ci_builds | 255 GB |
    (1 row)
  2. Enable feature flag

    Feature.enable(:database_reindexing)
  3. Run migration with bundle exec rails db:migrate

  4. Run bundle exec rails gitlab:db:reindex so the index is destroyed asynchronously

  5. Verify the index no longer exist

    gitlabhq_development=# \di+ index_ci_builds_on_token_encrypted;
    Did not find any relation named "index_ci_builds_on_token_encrypted".

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

Merge request reports

Loading