Commit 2db7afa3 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'remove-ancestor-flag' into 'master'

Remove preset_group_root feature flag

Closes #33638

See merge request gitlab-org/gitlab!22165
parents 7eb94603 7a811e8a
---
title: Remove N+1 query issue when checking group root ancestor.
merge_request:
author:
type: performance
......@@ -129,7 +129,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) }
......
......@@ -233,46 +233,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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment