Commit ff8fd0c8 authored by Mark Chao's avatar Mark Chao

Merge branch 'sh-drop-load-balancing-atomic-replica-ff' into 'master'

Remove load_balancing_atomic_replica feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!63380
parents 72fad99d 5bdb634f
---
name: load_balancing_atomic_replica
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49294
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/291193
milestone: '13.11'
type: development
group: group::database
default_enabled: true
...@@ -28,11 +28,7 @@ module Gitlab ...@@ -28,11 +28,7 @@ module Gitlab
# report no matching merge requests. To avoid this, we check # report no matching merge requests. To avoid this, we check
# the write location to ensure the replica can make this query. # the write location to ensure the replica can make this query.
track_session_metrics do track_session_metrics do
if ::Feature.enabled?(:load_balancing_atomic_replica, @project, default_enabled: :yaml)
::Gitlab::Database::LoadBalancing::Sticking.select_valid_host(:project, @project.id) ::Gitlab::Database::LoadBalancing::Sticking.select_valid_host(:project, @project.id)
else
::Gitlab::Database::LoadBalancing::Sticking.unstick_or_continue_sticking(:project, @project.id)
end
end end
end end
......
...@@ -56,6 +56,9 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do ...@@ -56,6 +56,9 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
before do before do
expect(::Gitlab::Database::LoadBalancing).to receive(:enable?).at_least(:once).and_return(true) expect(::Gitlab::Database::LoadBalancing).to receive(:enable?).at_least(:once).and_return(true)
allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:all_caught_up?).and_return(all_caught_up) allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:all_caught_up?).and_return(all_caught_up)
expect(::Gitlab::Database::LoadBalancing::Sticking).to receive(:select_valid_host).with(:project, project.id).and_call_original
allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:select_caught_up_replicas).with(:project, project.id).and_return(all_caught_up)
end end
shared_examples 'secondary that has caught up to a primary' do shared_examples 'secondary that has caught up to a primary' do
...@@ -84,32 +87,6 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do ...@@ -84,32 +87,6 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
end end
end end
context 'with load_balancing_atomic_replica feature flag enabled' do
before do
stub_feature_flags(load_balancing_atomic_replica: true)
expect(::Gitlab::Database::LoadBalancing::Sticking).to receive(:select_valid_host).with(:project, project.id).and_call_original
allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:select_caught_up_replicas).with(:project, project.id).and_return(all_caught_up)
end
it_behaves_like 'secondary that has caught up to a primary'
context 'on secondary behind primary' do
let(:all_caught_up) { false }
it_behaves_like 'secondary that is lagging primary'
end
end
context 'with load_balancing_atomic_replica feature flag disabled' do
before do
stub_feature_flags(load_balancing_atomic_replica: false)
expect(::Gitlab::Database::LoadBalancing::Sticking).not_to receive(:select_valid_host)
expect(::Gitlab::Database::LoadBalancing::Sticking).to receive(:unstick_or_continue_sticking).and_call_original
allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:all_caught_up?).and_return(all_caught_up)
end
it_behaves_like 'secondary that has caught up to a primary' it_behaves_like 'secondary that has caught up to a primary'
context 'on secondary behind primary' do context 'on secondary behind primary' do
...@@ -119,5 +96,4 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do ...@@ -119,5 +96,4 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
end end
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