Skip to content
代码片段 群组 项目
提交 2017fc40 编辑于 作者: Halil Coban's avatar Halil Coban
浏览文件

Merge branch 'sc1-rm-db-loadbalancing-multistore' into 'master'

Remove MultiStore in Gitlab::Redis::DbLoadBalancing

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137830



Merged-by: default avatarHalil Coban <hcoban@gitlab.com>
Reviewed-by: default avatarHalil Coban <hcoban@gitlab.com>
Co-authored-by: default avatarSylvester Chin <schin@gitlab.com>
No related branches found
No related tags found
无相关合并请求
---
name: use_primary_and_secondary_stores_for_db_load_balancing
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111269
rollout_issue_url:
milestone: '15.9'
type: development
group: group::scalability
default_enabled: false
---
name: use_primary_store_as_default_for_db_load_balancing
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111269
rollout_issue_url:
milestone: '15.9'
type: development
group: group::scalability
default_enabled: false
...@@ -8,15 +8,6 @@ class << self ...@@ -8,15 +8,6 @@ class << self
def config_fallback def config_fallback
SharedState SharedState
end end
private
def redis
primary_store = ::Redis.new(params)
secondary_store = ::Redis.new(config_fallback.params)
MultiStore.new(primary_store, secondary_store, store_name)
end
end end
end end
end end
......
...@@ -5,40 +5,4 @@ ...@@ -5,40 +5,4 @@
RSpec.describe Gitlab::Redis::DbLoadBalancing, feature_category: :scalability do RSpec.describe Gitlab::Redis::DbLoadBalancing, feature_category: :scalability do
include_examples "redis_new_instance_shared_examples", 'db_load_balancing', Gitlab::Redis::SharedState include_examples "redis_new_instance_shared_examples", 'db_load_balancing', Gitlab::Redis::SharedState
include_examples "redis_shared_examples" include_examples "redis_shared_examples"
describe '#pool' do
let(:config_new_format_host) { "spec/fixtures/config/redis_new_format_host.yml" }
let(:config_new_format_socket) { "spec/fixtures/config/redis_new_format_socket.yml" }
subject { described_class.pool }
before do
allow(described_class).to receive(:config_file_name).and_return(config_new_format_host)
# Override rails root to avoid having our fixtures overwritten by `redis.yml` if it exists
allow(Gitlab::Redis::SharedState).to receive(:rails_root).and_return(mktmpdir)
allow(Gitlab::Redis::SharedState).to receive(:config_file_name).and_return(config_new_format_socket)
end
around do |example|
clear_pool
example.run
ensure
clear_pool
end
it 'instantiates an instance of MultiStore' do
subject.with do |redis_instance|
expect(redis_instance).to be_instance_of(::Gitlab::Redis::MultiStore)
expect(redis_instance.primary_store.connection[:id]).to eq("redis://test-host:6379/99")
expect(redis_instance.secondary_store.connection[:id]).to eq("unix:///path/to/redis.sock/0")
expect(redis_instance.instance_name).to eq('DbLoadBalancing')
end
end
it_behaves_like 'multi store feature flags', :use_primary_and_secondary_stores_for_db_load_balancing,
:use_primary_store_as_default_for_db_load_balancing
end
end end
# frozen_string_literal: true
RSpec.shared_examples 'multi store feature flags' do |use_primary_and_secondary_stores, use_primary_store_as_default|
context "with feature flag :#{use_primary_and_secondary_stores} is enabled" do
before do
stub_feature_flags(use_primary_and_secondary_stores => true)
end
it 'multi store is enabled' do
subject.with do |redis_instance|
expect(redis_instance.use_primary_and_secondary_stores?).to be true
end
end
end
context "with feature flag :#{use_primary_and_secondary_stores} is disabled" do
before do
stub_feature_flags(use_primary_and_secondary_stores => false)
end
it 'multi store is disabled' do
subject.with do |redis_instance|
expect(redis_instance.use_primary_and_secondary_stores?).to be false
end
end
end
context "with feature flag :#{use_primary_store_as_default} is enabled" do
before do
stub_feature_flags(use_primary_store_as_default => true)
end
it 'primary store is enabled' do
subject.with do |redis_instance|
expect(redis_instance.use_primary_store_as_default?).to be true
end
end
end
context "with feature flag :#{use_primary_store_as_default} is disabled" do
before do
stub_feature_flags(use_primary_store_as_default => false)
end
it 'primary store is disabled' do
subject.with do |redis_instance|
expect(redis_instance.use_primary_store_as_default?).to be false
end
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册