Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7a811e8a
Commit
7a811e8a
authored
Dec 20, 2019
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove preset_group_root feature flag
This enables pre-setting group root ancestor by default.
parent
97f28e0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
35 deletions
+23
-35
changelogs/unreleased/remove-ancestor-flag.yml
changelogs/unreleased/remove-ancestor-flag.yml
+5
-0
ee/app/models/ee/group.rb
ee/app/models/ee/group.rb
+1
-1
ee/spec/models/group_spec.rb
ee/spec/models/group_spec.rb
+17
-34
No files found.
changelogs/unreleased/remove-ancestor-flag.yml
0 → 100644
View file @
7a811e8a
---
title
:
Remove N+1 query issue when checking group root ancestor.
merge_request
:
author
:
type
:
performance
ee/app/models/ee/group.rb
View file @
7a811e8a
...
...
@@ -133,7 +133,7 @@ module EE
# preset root_ancestor for all of them to avoid an additional SQL query
# done for each group permission check:
# https://gitlab.com/gitlab-org/gitlab/issues/11539
preset_root_ancestor_for
(
groups
)
if
same_root
&&
::
Feature
.
enabled?
(
:preset_group_root
)
preset_root_ancestor_for
(
groups
)
if
same_root
DeclarativePolicy
.
user_scope
do
groups
.
select
{
|
group
|
Ability
.
allowed?
(
user
,
:read_epic
,
group
)
}
...
...
ee/spec/models/group_spec.rb
View file @
7a811e8a
...
...
@@ -253,46 +253,29 @@ describe Group do
end
end
context
'with `preset_group_root` feature flag disabled'
do
before
do
stub_feature_flags
(
preset_group_root:
false
)
end
context
'when same_root is false'
do
let
(
:params
)
{
{
same_root:
false
}
}
# extra 6 queries:
# * getting root_ancestor
# * getting root ancestor's saml_provider
# * check if group has projects
# * max_member_access_for_user_from_shared_groups
# * max_member_access_for_user
# * self_and_ancestors_ids
it_behaves_like
'group root ancestor'
do
let
(
:params
)
{
{}
}
let
(
:extra_query_count
)
{
6
}
end
end
context
'with `preset_group_root` feature flag enabled'
do
before
do
stub_feature_flags
(
preset_group_root:
true
)
end
context
'when same_root is true'
do
let
(
:params
)
{
{
same_root:
true
}
}
context
'when same_root is false'
do
let
(
:params
)
{
{
same_root:
false
}
}
# extra 6 queries:
# * getting root_ancestor
# * getting root ancestor's saml_provider
# * check if group has projects
# * max_member_access_for_user_from_shared_groups
# * max_member_access_for_user
# * self_and_ancestors_ids
it_behaves_like
'group root ancestor'
do
let
(
:extra_query_count
)
{
6
}
end
end
context
'when same_root is true'
do
let
(
:params
)
{
{
same_root:
true
}
}
# avoids 2 queries from the list above:
# * getting root ancestor
# * getting root ancestor's saml_provider
it_behaves_like
'group root ancestor'
do
let
(
:extra_query_count
)
{
4
}
end
# avoids 2 queries from the list above:
# * getting root ancestor
# * getting root ancestor's saml_provider
it_behaves_like
'group root ancestor'
do
let
(
:extra_query_count
)
{
4
}
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment