Add & backfill sharding keys for snippet_user_mentions
Add and backfill multiple sharding keys for snippet_user_mentions. 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/snippet_user_mentions.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 three changes: - Adding a new column that will serve as the sharding key (along with the relevant index and foreign key). - 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 validate the not null constraint. 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/snippet_user_mentions.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 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/143774 This change was generated by [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper) using the Keeps::BackfillMultipleDesiredShardingKeySmallTable 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
显示
- db/docs/batched_background_migrations/backfill_snippet_user_mentions_snippet_organization_id.yml 8 个添加, 0 个删除...ackfill_snippet_user_mentions_snippet_organization_id.yml
- db/docs/batched_background_migrations/backfill_snippet_user_mentions_snippet_project_id.yml 8 个添加, 0 个删除...ons/backfill_snippet_user_mentions_snippet_project_id.yml
- db/docs/snippet_user_mentions.yml 3 个添加, 0 个删除db/docs/snippet_user_mentions.yml
- db/migrate/20250209004149_add_snippet_project_id_to_snippet_user_mentions.rb 9 个添加, 0 个删除...004149_add_snippet_project_id_to_snippet_user_mentions.rb
- db/migrate/20250209004154_add_snippet_organization_id_to_snippet_user_mentions.rb 9 个添加, 0 个删除...4_add_snippet_organization_id_to_snippet_user_mentions.rb
- db/post_migrate/20250209004150_index_snippet_user_mentions_on_snippet_project_id.rb 16 个添加, 0 个删除...4150_index_snippet_user_mentions_on_snippet_project_id.rb
- db/post_migrate/20250209004151_add_snippet_user_mentions_snippet_project_id_fk.rb 16 个添加, 0 个删除...004151_add_snippet_user_mentions_snippet_project_id_fk.rb
- db/post_migrate/20250209004152_add_snippet_user_mentions_snippet_project_id_trigger.rb 25 个添加, 0 个删除...2_add_snippet_user_mentions_snippet_project_id_trigger.rb
- db/post_migrate/20250209004153_queue_backfill_snippet_user_mentions_snippet_project_id.rb 40 个添加, 0 个删除...ueue_backfill_snippet_user_mentions_snippet_project_id.rb
- db/post_migrate/20250209004155_index_snippet_user_mentions_on_snippet_organization_id.rb 16 个添加, 0 个删除...index_snippet_user_mentions_on_snippet_organization_id.rb
- db/post_migrate/20250209004156_add_snippet_user_mentions_snippet_organization_id_fk.rb 17 个添加, 0 个删除...6_add_snippet_user_mentions_snippet_organization_id_fk.rb
- db/post_migrate/20250209004157_add_snippet_user_mentions_snippet_organization_id_trigger.rb 25 个添加, 0 个删除..._snippet_user_mentions_snippet_organization_id_trigger.rb
- db/post_migrate/20250209004158_queue_backfill_snippet_user_mentions_snippet_organization_id.rb 40 个添加, 0 个删除...backfill_snippet_user_mentions_snippet_organization_id.rb
- db/schema_migrations/20250209004149 1 个添加, 0 个删除db/schema_migrations/20250209004149
- db/schema_migrations/20250209004150 1 个添加, 0 个删除db/schema_migrations/20250209004150
- db/schema_migrations/20250209004151 1 个添加, 0 个删除db/schema_migrations/20250209004151
- db/schema_migrations/20250209004152 1 个添加, 0 个删除db/schema_migrations/20250209004152
- db/schema_migrations/20250209004153 1 个添加, 0 个删除db/schema_migrations/20250209004153
- db/schema_migrations/20250209004154 1 个添加, 0 个删除db/schema_migrations/20250209004154
- db/schema_migrations/20250209004155 1 个添加, 0 个删除db/schema_migrations/20250209004155
db/schema_migrations/20250209004149
0 → 100644
db/schema_migrations/20250209004150
0 → 100644
db/schema_migrations/20250209004151
0 → 100644
db/schema_migrations/20250209004152
0 → 100644
db/schema_migrations/20250209004153
0 → 100644
db/schema_migrations/20250209004154
0 → 100644
db/schema_migrations/20250209004155
0 → 100644
想要评论请 注册 或 登录