Resolve "Linear roots scope"
What does this MR do and why?
Introduce a recursive and linear roots scope to query for all root ancestors. The linear set of scopes are more efficient and less cumbersome than the recursive set.
Group.where('created_at > ?', 2.weeks.ago).roots
SQL
SELECT
"namespaces"."id",
"namespaces"."name",
"namespaces"."path",
"namespaces"."owner_id",
"namespaces"."created_at",
"namespaces"."updated_at",
"namespaces"."type",
"namespaces"."description",
"namespaces"."avatar",
"namespaces"."membership_lock",
"namespaces"."share_with_group_lock",
"namespaces"."visibility_level",
"namespaces"."request_access_enabled",
"namespaces"."ldap_sync_status",
"namespaces"."ldap_sync_error",
"namespaces"."ldap_sync_last_update_at",
"namespaces"."ldap_sync_last_successful_update_at",
"namespaces"."ldap_sync_last_sync_at",
"namespaces"."description_html",
"namespaces"."lfs_enabled",
"namespaces"."parent_id",
"namespaces"."shared_runners_minutes_limit",
"namespaces"."repository_size_limit",
"namespaces"."require_two_factor_authentication",
"namespaces"."two_factor_grace_period",
"namespaces"."cached_markdown_version",
"namespaces"."project_creation_level",
"namespaces"."runners_token",
"namespaces"."file_template_project_id",
"namespaces"."saml_discovery_token",
"namespaces"."runners_token_encrypted",
"namespaces"."custom_project_templates_group_id",
"namespaces"."auto_devops_enabled",
"namespaces"."extra_shared_runners_minutes_limit",
"namespaces"."last_ci_minutes_notification_at",
"namespaces"."last_ci_minutes_usage_notification_level",
"namespaces"."subgroup_creation_level",
"namespaces"."emails_disabled",
"namespaces"."max_pages_size",
"namespaces"."max_artifacts_size",
"namespaces"."mentions_disabled",
"namespaces"."default_branch_protection",
"namespaces"."unlock_membership_to_ldap",
"namespaces"."max_personal_access_token_lifetime",
"namespaces"."push_rule_id",
"namespaces"."shared_runners_enabled",
"namespaces"."allow_descendants_override_disabled_shared_runners",
"namespaces"."traversal_ids"
FROM
"namespaces"
WHERE
"namespaces"."type" = 'Group'
AND "namespaces"."id" IN (
SELECT
traversal_ids[1]
FROM
"namespaces"
WHERE
"namespaces"."type" = 'Group'
AND "namespaces"."id" IN (12285090, 12285085, 12128747)
)
Query plan https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7226/commands/25611
How to set up and validate locally
Feature.enable :use_traversal_ids
Feature.enable :use_traversal_ids_roots
roots = FactoryBot.create_list :group, 4, :with_hierarchy
Group.all.roots == roots
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 #339441 (closed)
Merge request reports
Activity
changed milestone to %14.5
assigned to @alexpooley
- Resolved by Mark Chao
@alexpooley, please can you answer the question: Should this have a feature flag? to help with code review for the Access group.This nudge was added by this triage-ops policy.
- A deleted user
added feature flag label
1 Message CHANGELOG missing: If you want to create a changelog entry for GitLab FOSS, add the
Changelog
trailer to the commit message you want to add to the changelog.If you want to create a changelog entry for GitLab EE, also add the
EE: true
trailer to your commit message.If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Mehmet Emin Inac ( @minac
) (UTC+1, 7 hours behind@alexpooley
)Dylan Griffith ( @DylanGriffith
) (UTC+11, 3 hours ahead of@alexpooley
)To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Dangeradded 1 deleted label and removed feature flag groupauthentication and authorization [DEPRECATED] labels
- A deleted user
added feature flag label
added 239 commits
-
25efa929...806407d3 - 238 commits from branch
master
- 05d922c2 - Query scope for group ancestor roots
-
25efa929...806407d3 - 238 commits from branch
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
- Resolved by Marius Bobin
- Resolved by Marius Bobin
removed review request for @mbobin
added databaseapproved label
removed review request for @tigerwnz
@tigerwnz
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
added 174 commits
-
05d922c2...80f681f7 - 173 commits from branch
master
- 9ab346f1 - Query scope for group ancestor roots
-
05d922c2...80f681f7 - 173 commits from branch
requested review from @mbobin
enabled an automatic merge when the pipeline for 2c8b78af succeeds
mentioned in commit 62abdcc4
added workflowstaging-canary label
added workflowstaging label and removed workflowstaging-canary label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
mentioned in epic &5296 (closed)
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
added devopsdata stores grouptenant scale sectioncore platform labels and removed devopsmanage sectiondev + 1 deleted label