Draft: Add organization_id to ci_runners
What does this MR do and why?
This MR is meant to prepare the ci_runners
table for Cells 1.0. It:
- adds the
organization_id
column toci_runners
. - adds a post-deployment migration to set the value on all the instance runners to -1.
- adds app code to correctly initialize the
organization_id
field for new runners.
Changelog: added
Part of #442395
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
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Create a new runner in http://gdk.test:3000/admin/runners and one in http://gdk.test:3000/groups/gitlab-org/-/runners. The first one should have NULL organization_id
, while the second should have 1
.
Database query plan
Post-deployment migration
https://postgres.ai/console/gitlab/gitlab-production-ci/sessions/29263/commands/91052
SELECT *
FROM ci_runners
WHERE runner_type = 1
AND organization_id != - 1
LIMIT 1000;
Limit (cost=0.43..120.10 rows=91 width=233) (actual time=0.101..1.920 rows=110 loops=1)
Buffers: shared hit=126 dirtied=119
I/O Timings: read=0.000 write=0.000
-> Index Scan using index_ci_runners_on_runner_type_and_id on public.ci_runners (cost=0.43..120.10 rows=91 width=233) (actual time=0.100..1.907 rows=110 loops=1)
Index Cond: (ci_runners.runner_type = 1)
Filter: (ci_runners.organization_id <> '-1'::integer)
Rows Removed by Filter: 0
Buffers: shared hit=126 dirtied=119
I/O Timings: read=0.000 write=0.000
Edited by Pedro Pombeiro