Loading
Cleanup lazy-generation for Ci::Runner#uuid
What does this MR do and why?
Cleanup lazy-generation for Ci::Runner#uuid
Follow-up for Add UUID for ci_runners entities (!235296 - merged) and Finalize BBM BackfillCiRunnersUuid (!251000 - merged).
It removes the temporary lazy-generation that was added to ensure
each Ci::Runner has an uuid, even if the BBM backfill didn't reach
a record yet.
The backfill is finalized since 19.4 and the 19.5 required stop has passed, so every runner has a uuid. Instead of the lazy getter, the invariant is now enforced by the databases:
- PostgreSQL:
db/post_migrate/20261028125150_add_not_null_constraint_to_ci_runners_uuid.rbadds aNOT NULLcheck constraint onci_runners.uuid(propagated to all partitions). The table istable_size: small, so the constraint is validated in the same migration. - ClickHouse:
db/click_house/post_migrate/main/20261028130500_make_siphon_ci_runners_uuid_non_nullable.rbchangessiphon_ci_runners.uuidfromNullable(UUID)toUUID, as requested in !235296 (comment 3515462584). StaleNULLrows left from before the backfill are set to the zero UUID first: ClickHouse < 25.12 fails the type change onNULLs, and >= 25.12 requires an explicitDEFAULT. Tested on 25.1.8.25 and 26.2.13.2 (the versions used in CI).
References
- Add UUID for ci_runners entities (!235296 - merged)
- Finalize BBM BackfillCiRunnersUuid (!251000 - merged)
- !235296 (comment 3515462584)
Rollback
- PostgreSQL:
downremoves the check constraint. No data is changed. - ClickHouse:
downrestoresuuid Nullable(UUID)without a default. Zero UUIDs written byupare not reverted toNULL: they carry the same "no uuid" meaning, and reverting them would need another data-rewriting mutation. This is noted in the migration. - Application code: reverting this MR brings back the lazy getter, which is safe with either database state.
Screenshots or screen recordings
N/A - no UI changes.
How to set up and validate locally
- Run the PostgreSQL migration and check the constraint:
bin/rails db:migrateSELECT conrelid::regclass, conname FROM pg_constraint WHERE conname = 'check_55f3874e19'; - With ClickHouse configured, run the ClickHouse migrations and check the column:
bundle exec rake gitlab:clickhouse:migrateSHOW CREATE TABLE siphon_ci_runners;
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Tomasz Maczukin