Solving database cross joins on HookData::ProjectBuilder
What does this MR do?
Fixing cross joins on Gitlab::HookData::ProjectBuilder
, which are preventing a Project with a README file from being created on a secondary cell. This MR is necessary to unblock upcoming Cells Iteration 3 Demo #420118 (closed)
As part of the Cells project, we are changing many of the queries that are doing cross database joins to querying both databases main
and main_clusterwide
, while maintaining the current performance of the querying. For more on the topic, you can refer to this documentation.
Addressing part of : #432604 (closed)
Newly introduced database queries
1. When the Project is a Group project
- Loading members (via
find_each
) https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/24635/commands/78397 - Loading users (using
preload_user
) https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/24635/commands/78398
2. When the Project is a Personal Namespace Project
- Loading Project Authorizations (via each_batch) https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/24635/commands/78399
- Loading users. Same as the loading users query in previous section
☝
How to set up and validate locally
These tests can be done on a one cell GDK setup
- Create a project on a personal namespace with a README file, make sure you get no errors and the readme file is visible.
- Create a project on a group, make sure you get no errors, make sure you get no errors and the readme file is visible.
Optional: If you want to test on another GDK cell
- Follow the instructions here to create another GDK cell: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/cells.md?ref_type=heads
- On the 2nd Cell, enable the FF via Rails Console:
Feature.enable(:optimize_where_full_path_in)
- On the 2nd Cell, we still need a Personal Namespace for the logged in user. Create it via
FactoryBot.create(:user_namespace, owner: User.first)
(replace theUser.first
with the user you are using). This is not resolved yet. See #432815 (closed) - Create a Group and a Project with README file on Cell 2
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.
Related to #432604 (closed)
Edited by Omar Qunsul