Skip to content

Add and backfill sharding keys for deploy_tokens

What does this MR do and why?

There are three parts to this change:

  • Add columns/indexes/foreign keys for the two sharding keys. Deploy tokens can belong to either a project or a group, so two columns are required (see the final example in Defining a sharding key for all cell-local tables).
  • Queue a background migration to backfill the sharding key using the project_deploy_tokens and group_deploy_tokens join tables.
  • Set the relevant project or group ID when creating new tokens.

Note that these changes were not generated by Gitlab Housekeeper.

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.

How to set up and validate locally

  1. Navigate to any project's repository settings, and create a deploy token (any name/scope).
  2. In the Rails console, inspect the created token with DeployToken.last and verify the project_id matches the project you selected.
  3. Repeat steps 1-2 for any group, instead verifying the group_id matches.

Related to #462932 (closed)

Edited by Tiger Watson

Merge request reports

Loading