BE: Add new query API to list available agents under a group in RD
Issue: #441555 (closed)
What does this MR do and why?
- Adds query API to return the list of list remote development agents during workspace creation
- The list of agents returned are based on the agents that may be mapped to the namespace being passed or its ancestor namespaces
- More details can be found in the relevant section within the technical design
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.
Query Plan
For the new scope:
gitlabhq_development=# explain select * from remote_development_namespace_cluster_agent_mappings where namespace_id in (21, 22, 24);
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan using unique_namespace_cluster_agent_mappings_for_agent_association on remote_development_namespace_cluster_agent_mappings (cost=0.15..11.73 rows=16 width=48)
Index Cond: (namespace_id = ANY ('{21,22,24}'::bigint[]))
(2 rows)
For the filtering of valid mappings:
gitlabhq_development=# explain select * from cluster_agents where id in (2);
QUERY PLAN
-------------------------------------------------------------------------------------------
Index Scan using cluster_agents_pkey on cluster_agents (cost=0.15..2.17 rows=1 width=73)
Index Cond: (id = 2)
(2 rows)
gitlabhq_development=# explain select * from projects where id in (3);
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------
Index Scan using idx_projects_on_repository_storage_last_repository_updated_at on projects (cost=0.14..2.16 rows=1 width=1443)
Index Cond: (id = 3)
(2 rows)
gitlabhq_development=# explain select * from namespaces where id in (26);
QUERY PLAN
------------------------------------------------------------------------------------
Index Scan using namespaces_pkey on namespaces (cost=0.14..2.16 rows=1 width=533)
Index Cond: (id = 26)
(2 rows)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Edited by Hunar Khanna