-
- Downloads
Add and backfill project_id for ci_job_artifact_states
## What does this MR do and why? Add and backfill project_id for ci_job_artifact_states. This table has a [desired sharding key](https://docs.gitlab.com/ee/development/database/multiple_databases.html#define-a-desired_sharding_key-to-automatically-backfill-a-sharding_key) configured ([view configuration](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/docs/ci_job_artifact_states.yml)). This merge request is the first step towards transforming the desired sharding key into a [sharding key](https://docs.gitlab.com/ee/development/database/multiple_databases.html#defining-a-sharding-key-for-all-cell-local-tables). This involves the following changes: - Adding a new column that will serve as the sharding key (along with the relevant asynchronous index). - Populating the sharding key when new records are created by adding a database function and trigger. - Scheduling a [batched background migration](https://docs.gitlab.com/ee/development/database/batched_background_migrations.html) to set the sharding key for existing records. Once the background migration has completed, a second merge request will be created to finalize the background migration, and add a foreign key and not null constraint. ## How to verify We have assigned a random backend engineer from ~"group::geo" to review these changes. Please review this merge request from a ~backend perspective. The main thing we are looking to verify is that the added column and association match the values specified by the [desired sharding key](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/docs/ci_job_artifact_states.yml) configuration and that backfilling the column from this other table makes sense in the context of this feature. When you are finished, please: 1. Trigger the [database testing pipeline](https://docs.gitlab.com/ee/development/database/database_migration_pipeline.html) as instructed by Danger. 1. Request a review from the ~backend maintainer and ~database reviewer suggested by Danger. If you have any questions or concerns, reach out to @tigerwnz or @shubhamkrai. This merge request was generated by a once off keep implemented in !143774 This change was generated by [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper) using the Keeps::BackfillDesiredShardingKeyLargeTable keep. To provide feedback on your experience with `gitlab-housekeeper` please create an issue with the label ~"GitLab Housekeeper" and consider pinging the author of this keep. Changelog: other
parent
27995886
No related branches found
No related tags found
Showing
- db/docs/batched_background_migrations/backfill_ci_job_artifact_states_project_id.yml 9 additions, 0 deletions...migrations/backfill_ci_job_artifact_states_project_id.yml
- db/docs/ci_job_artifact_states.yml 1 addition, 0 deletionsdb/docs/ci_job_artifact_states.yml
- db/migrate/20240912122437_add_project_id_to_ci_job_artifact_states.rb 9 additions, 0 deletions...0240912122437_add_project_id_to_ci_job_artifact_states.rb
- db/post_migrate/20240912122438_prepare_index_ci_job_artifact_states_on_project_id.rb 16 additions, 0 deletions...438_prepare_index_ci_job_artifact_states_on_project_id.rb
- db/post_migrate/20240912122439_add_ci_job_artifact_states_project_id_trigger.rb 25 additions, 0 deletions...12122439_add_ci_job_artifact_states_project_id_trigger.rb
- db/post_migrate/20240912122440_queue_backfill_ci_job_artifact_states_project_id.rb 40 additions, 0 deletions...22440_queue_backfill_ci_job_artifact_states_project_id.rb
- db/schema_migrations/20240912122437 1 addition, 0 deletionsdb/schema_migrations/20240912122437
- db/schema_migrations/20240912122438 1 addition, 0 deletionsdb/schema_migrations/20240912122438
- db/schema_migrations/20240912122439 1 addition, 0 deletionsdb/schema_migrations/20240912122439
- db/schema_migrations/20240912122440 1 addition, 0 deletionsdb/schema_migrations/20240912122440
- db/structure.sql 19 additions, 0 deletionsdb/structure.sql
- lib/gitlab/background_migration/backfill_ci_job_artifact_states_project_id.rb 10 additions, 0 deletions...d_migration/backfill_ci_job_artifact_states_project_id.rb
- spec/db/schema_spec.rb 1 addition, 1 deletionspec/db/schema_spec.rb
- spec/lib/gitlab/background_migration/backfill_ci_job_artifact_states_project_id_spec.rb 17 additions, 0 deletions...ration/backfill_ci_job_artifact_states_project_id_spec.rb
- spec/migrations/20240912122440_queue_backfill_ci_job_artifact_states_project_id_spec.rb 33 additions, 0 deletions..._queue_backfill_ci_job_artifact_states_project_id_spec.rb
db/schema_migrations/20240912122437
0 → 100644
db/schema_migrations/20240912122438
0 → 100644
db/schema_migrations/20240912122439
0 → 100644
db/schema_migrations/20240912122440
0 → 100644
-
mentioned in merge request kubitus-project/kubitus-installer!3429 (merged)
-
mentioned in merge request !167405 (merged)
-
mentioned in merge request !166950 (closed)
Please register or sign in to comment