diff --git a/changelogs/unreleased/196838-remove-routing-ff.yml b/changelogs/unreleased/196838-remove-routing-ff.yml new file mode 100644 index 0000000000000000000000000000000000000000..51529a12b6acdfa17b6b4de2ff611b9f394605a9 --- /dev/null +++ b/changelogs/unreleased/196838-remove-routing-ff.yml @@ -0,0 +1,5 @@ +--- +title: Improve Advanced global search performance by using routing +merge_request: 27398 +author: +type: performance diff --git a/ee/lib/elastic/latest/routing.rb b/ee/lib/elastic/latest/routing.rb index 09f2b83a2bc571ce20f8cfdbfb4b5d0d6b8385a0..5abc98f0c97364860545ef9bde14e325884b0e3f 100644 --- a/ee/lib/elastic/latest/routing.rb +++ b/ee/lib/elastic/latest/routing.rb @@ -8,7 +8,6 @@ module Elastic ES_ROUTING_MAX_COUNT = 128 def routing_options(options) - return {} if Feature.disabled?(:elasticsearch_use_routing) return {} if options[:public_and_internal_projects] ids = if options[:project_id] diff --git a/ee/spec/lib/elastic/latest/routing_spec.rb b/ee/spec/lib/elastic/latest/routing_spec.rb index e9e2e65bc12f49caab9253f3bf6184791e053d6e..f6a89b621ec8a0f0270156ed40730c690c456bc7 100644 --- a/ee/spec/lib/elastic/latest/routing_spec.rb +++ b/ee/spec/lib/elastic/latest/routing_spec.rb @@ -27,62 +27,40 @@ describe Elastic::Latest::Routing do end describe '#routing_options' do - include StubFeatureFlags - - context 'when feature flag is enabled' do - before do - stub_feature_flags(elasticsearch_use_routing: true) - end - - it 'returns correct options for project_id' do - expect(subject.routing_options({ project_id: 1 })).to eq({ routing: 'project_1' }) - end - - it 'returns correct options for repository_id' do - expect(subject.routing_options({ repository_id: 1 })).to eq({ routing: 'project_1' }) - end - - it 'returns correct options for project_ids' do - expect(subject.routing_options({ project_ids: project_ids })).to eq({ routing: project_routing }) - end + it 'returns correct options for project_id' do + expect(subject.routing_options({ project_id: 1 })).to eq({ routing: 'project_1' }) + end - it 'returns empty hash when provided an empty array' do - expect(subject.routing_options({ project_ids: [] })).to eq({}) - end + it 'returns correct options for repository_id' do + expect(subject.routing_options({ repository_id: 1 })).to eq({ routing: 'project_1' }) + end - it 'returns empty hash when provided :any to project_ids' do - expect(subject.routing_options({ project_ids: :any })).to eq({}) - end + it 'returns correct options for project_ids' do + expect(subject.routing_options({ project_ids: project_ids })).to eq({ routing: project_routing }) + end - it 'returns empty hash when public projects flag is passed' do - expect(subject.routing_options({ project_ids: project_ids, public_and_internal_projects: true })).to eq({}) - end + it 'returns empty hash when provided an empty array' do + expect(subject.routing_options({ project_ids: [] })).to eq({}) + end - it 'uses project_ids rather than repository_id when both are supplied' do - options = { project_ids: project_ids, repository_id: 'wiki_5' } + it 'returns empty hash when provided :any to project_ids' do + expect(subject.routing_options({ project_ids: :any })).to eq({}) + end - expect(subject.routing_options(options)).to eq({ routing: project_routing }) - end + it 'returns empty hash when public projects flag is passed' do + expect(subject.routing_options({ project_ids: project_ids, public_and_internal_projects: true })).to eq({}) + end - it 'returns empty hash when there are too many project_ids' do - max_count = included_class::ES_ROUTING_MAX_COUNT + it 'uses project_ids rather than repository_id when both are supplied' do + options = { project_ids: project_ids, repository_id: 'wiki_5' } - expect(subject.routing_options({ project_ids: 1.upto(max_count + 1).to_a })).to eq({}) - end + expect(subject.routing_options(options)).to eq({ routing: project_routing }) end - context 'when feature flag is disabled' do - before do - stub_feature_flags(elasticsearch_use_routing: false) - end - - it 'returns empty hash for project_ids' do - expect(subject.routing_options({ project_ids: project_ids })).to eq({}) - end + it 'returns empty hash when there are too many project_ids' do + max_count = included_class::ES_ROUTING_MAX_COUNT - it 'returns empty hash for empty options' do - expect(subject.routing_options({})).to eq({}) - end + expect(subject.routing_options({ project_ids: 1.upto(max_count + 1).to_a })).to eq({}) end end end