Add NOT NULL on sharding key for ci_build_trace_chunks
What does this MR do and why?
Adds NOT NULL constraint on sharding key column project_id on table: ci_build_trace_chunks.
This merge request is the last step towards transforming the desired sharding key into a sharding key.
This involves the following changes:
- Adding a not null constraint for the sharding key column (
project_id
). - Setting
project_id
assharding_key
ofci_build_trace_chunks
.
Note: We do not add presence: true
check because we're relying on "BEFORE INSERT OR UPDATE" trigger to populate
the column from its parent table. We have no defined plan yet for the removal of these triggers but we will ensure
that application code is writing the value first removing them.
References
- Organization Isolation and Sharding Keys: https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/organization/isolation/
- Sharding Key (Cells) Development Guide: https://docs.gitlab.com/ee/development/cells/#defining-a-sharding-key-for-all-cell-local-tables
- Related to #493768 (closed)
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.
Screenshots or screen recordings
N/A
How to verify
The main thing we are looking to verify is that the BackfillCiBuildTraceChunksProjectId
batched background migration has been successfully finalized in a previous merge request, and that the constraint
matches the column specified by the desired sharding key
configuration.
This change was generated by gitlab-housekeeper using the Keeps::AddNotNullConstraintShardingKey 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.