Add `active` parameter to ProjectFinder
What does this MR do and why?
Add active
parameter to the ProjectFinder determines whether to include or exclude active projects.
Active projects are those that are neither archived
or marked_for_deletion
.
This parameter is needed to allow filtering for inactive/active groups on our APIs #467265 (closed)
Query Plans
Added the query plan of an existing parameter to use as a baseline.
It is difficult to get results within our desired timing guideline because project finder is historically known to suffer from performance issues (e.g. 500 HTTP error)
Before (with an existing parameter archived=only
)
- True Cold: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37576/commands/114796
- Cold: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37576/commands/114798
- Warm: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37576/commands/114799
After (with the new parameter active=false
)
- True Cold: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37576/commands/114802
- Cold: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37576/commands/114804
- Warm: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37576/commands/114805
Before (with an existing parameter archived=false
)
- True Cold:
- Cold: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37643/commands/114984
- Warm: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37643/commands/114985
After (with the new parameter active=true
)
- True Cold: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37643/commands/114969
- Cold: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37643/commands/114971
- Warm: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/37643/commands/114972
Note:
- Adding index to the
projects
table is discouraged due to the existing number of indexes in the table. Our long term plan (proposal) is to use advance search like elastic search - The true cold query plan timing is not completely accurate because its hard to reproduce the queries in this state (no option in postgres.ai to clean OS cache).
References
- Related discussion about the performance concern (internal): https://gitlab.slack.com/archives/C3NBYFJ6N/p1742372795162159
- Closes #525631 (closed)
- Related to #467265 (closed)
Screenshots or screen recordings
N/A
How to set up and validate locally
- Add EE license to your GDK instance.
- On a project, go to
Settings
>General
>Advanced
>Delete Project
to move the project for pending delete. - On another project, go to
Settings
>General
>Advanced
>Archive Project
to move the project to archived. - In the rails console, run the following:
-
ProjectsFinder.new(current_user: User.first, params: { active: false }).execute
: to get inactive projects. -
ProjectsFinder.new(current_user: User.first, params: { active: true }).execute
: to get active + inactive projects.
-
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.