Draft: Update User#owns_runner to support decomposed databases
What does this MR do and why?
Update User#owns_runner
query to support decomposed databases
Related issue: https://gitlab.com/gitlab-org/gitlab/-/issues/336436
Data from production: we can see below that for a given runner, there is at most 10 rows in ci_runner_namespaces, and 1000 rows in ci_runner_projects.
gitlabhq_production=> select count(1) from (select runner_id from ci_runner_projects group by runner_id having count(runner_id) > 200) as counts;
count
-------
30
(1 row)
gitlabhq_production=> select count(1) from (select runner_id from ci_runner_projects group by runner_id having count(runner_id) > 500) as counts;
count
-------
1
(1 row)
gitlabhq_production=> select count(1) from (select runner_id from ci_runner_projects group by runner_id having count(runner_id) > 1000) as counts;
count
-------
0
(1 row)
gitlabhq_production=> select count(1) from (select runner_id from ci_runner_namespaces group by runner_id having count(runner_id) > 10) as counts;
count
-------
0
(1 row)
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.