Use Group#all_projects instead of self_and_descendants in finders
In https://gitlab.com/gitlab-com/gl-infra/production/-/issues/3894, we found that query plans using self_and_descendants
as a subquery in an IN ()
clause may trigger a PostgreSQL v11 query planner bug. !56078 (merged) works around this issue, but finders may have to take advantage of this by calling Group#all_projects
instead of base_and_descendants
.
We fixed one example in Maven (!56346 (merged)), but we do have of other locations where this may be an issue:
Proposal
Update all relevant finders:
# git grep --name-only self_and_descendants | grep finders
-
app/finders/ci/runners_finder.rb -
app/finders/labels_finder.rb -
app/finders/concerns/packages/finder_helper.rb -
app/finders/packages/npm/package_finder.rb -
app/finders/packages/group_packages_finder.rb -
app/finders/packages/maven/package_finder.rb -
app/finders/issuable_finder/params.rb -
ee/app/finders/epics_finder.rb -
ee/app/finders/ee/deployments_finder.rb -
ee/app/finders/ee/fork_targets_finder.rb
Edited by Andrew Newdigate OoO