Commit 5ea31b5a authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch '196838-remove-routing-ff' into 'master'

Remove elasticsearch_use_routing feature flag

See merge request gitlab-org/gitlab!27398
parents f600c3e7 ceab1698
---
title: Improve Advanced global search performance by using routing
merge_request: 27398
author:
type: performance
...@@ -8,7 +8,6 @@ module Elastic ...@@ -8,7 +8,6 @@ module Elastic
ES_ROUTING_MAX_COUNT = 128 ES_ROUTING_MAX_COUNT = 128
def routing_options(options) def routing_options(options)
return {} if Feature.disabled?(:elasticsearch_use_routing)
return {} if options[:public_and_internal_projects] return {} if options[:public_and_internal_projects]
ids = if options[:project_id] ids = if options[:project_id]
......
...@@ -27,62 +27,40 @@ describe Elastic::Latest::Routing do ...@@ -27,62 +27,40 @@ describe Elastic::Latest::Routing do
end end
describe '#routing_options' do describe '#routing_options' do
include StubFeatureFlags it 'returns correct options for project_id' do
expect(subject.routing_options({ project_id: 1 })).to eq({ routing: 'project_1' })
context 'when feature flag is enabled' do end
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 empty hash when provided an empty array' do it 'returns correct options for repository_id' do
expect(subject.routing_options({ project_ids: [] })).to eq({}) expect(subject.routing_options({ repository_id: 1 })).to eq({ routing: 'project_1' })
end end
it 'returns empty hash when provided :any to project_ids' do it 'returns correct options for project_ids' do
expect(subject.routing_options({ project_ids: :any })).to eq({}) expect(subject.routing_options({ project_ids: project_ids })).to eq({ routing: project_routing })
end end
it 'returns empty hash when public projects flag is passed' do it 'returns empty hash when provided an empty array' do
expect(subject.routing_options({ project_ids: project_ids, public_and_internal_projects: true })).to eq({}) expect(subject.routing_options({ project_ids: [] })).to eq({})
end end
it 'uses project_ids rather than repository_id when both are supplied' do it 'returns empty hash when provided :any to project_ids' do
options = { project_ids: project_ids, repository_id: 'wiki_5' } expect(subject.routing_options({ project_ids: :any })).to eq({})
end
expect(subject.routing_options(options)).to eq({ routing: project_routing }) it 'returns empty hash when public projects flag is passed' do
end 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 it 'uses project_ids rather than repository_id when both are supplied' do
max_count = included_class::ES_ROUTING_MAX_COUNT options = { project_ids: project_ids, repository_id: 'wiki_5' }
expect(subject.routing_options({ project_ids: 1.upto(max_count + 1).to_a })).to eq({}) expect(subject.routing_options(options)).to eq({ routing: project_routing })
end
end end
context 'when feature flag is disabled' do it 'returns empty hash when there are too many project_ids' do
before do max_count = included_class::ES_ROUTING_MAX_COUNT
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 for empty options' do expect(subject.routing_options({ project_ids: 1.upto(max_count + 1).to_a })).to eq({})
expect(subject.routing_options({})).to eq({})
end
end end
end 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