Fully shard clusters_kubernetes_namespaces
Summary
The clusters_kubernetes_namespaces table currently has desired_sharding_key defined but is missing the sharding_key_issue_url attribute. This issue tracks the work needed to implement the sharding key for this table.
Table Information
-
Table name:
clusters_kubernetes_namespaces -
Schema:
gitlab_main_org -
Desired sharding keys:
-
sharding_project_id(references projects) -
group_id(references namespaces) -
organization_id(references organizations)
-
-
Backfill strategy: Via parent table
clusters
Implementation Plan
Milestone 18.9
-
Prepare to shard table -> !216886 (merged)
- Add
organization_id,group_id&&sharding_project_idcolumns - Create a trigger that assigns the sharding key
- Index each sharding key column
- Add a foreign key constraint on each sharding key column
- Add a not null (not valid) constraint on the sharding key
- Backfill the sharding key
- Add
- Verify the sharding key backfill completes successfully
- Verify the backfill has assigned a sharding key column to all rows -> https://postgres.ai/console/gitlab/gitlab-production-main/sessions/47531/commands/143796
Milestone 18.11 (Required stop)
Milestone 19.0
-
Fully shard table
- Validate column indexes
- Remove any rows that point to a row that no longer exists through the foreign key constraint
- Validate foreign key constraints
- Validate sharding key
-
Update table documentation with
sharding_keyand removedesired_sharding_key
Related
Edited by Tomasz Skorupa