Commit 81becdae authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'sh-remove-matching-mr-db-sync-ff' into 'master'

Drop matching_merge_request_db_sync feature flag

See merge request gitlab-org/gitlab!49644
parents 0ced7697 e20eacf7
---
title: Drop matching_merge_request_db_sync feature flag
merge_request: 49644
author:
type: changed
---
name: matching_merge_request_db_sync
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42435
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/254488
milestone: '13.5'
type: development
group: group::create
default_enabled: true
...@@ -11,7 +11,6 @@ module EE ...@@ -11,7 +11,6 @@ module EE
override :match? override :match?
def match? def match?
return super unless ::Feature.enabled?(:matching_merge_request_db_sync, default_enabled: true)
return super unless ::Gitlab::Database::LoadBalancing.enable? return super unless ::Gitlab::Database::LoadBalancing.enable?
# When a user merges a merge request, the following sequence happens: # When a user merges a merge request, the following sequence happens:
......
...@@ -40,14 +40,15 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do ...@@ -40,14 +40,15 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
context 'with load balancing enabled', :request_store, :redis do context 'with load balancing enabled', :request_store, :redis do
let(:session) { ::Gitlab::Database::LoadBalancing::Session.current } let(:session) { ::Gitlab::Database::LoadBalancing::Session.current }
let(:all_caught_up) { true }
context 'on secondary that has caught up to primary' do before do
before do expect(::Gitlab::Database::LoadBalancing).to receive(:enable?).and_return(true)
allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:all_caught_up?).and_return(true) expect(::Gitlab::Database::LoadBalancing::Sticking).to receive(:unstick_or_continue_sticking).and_call_original
expect(::Gitlab::Database::LoadBalancing).to receive(:enable?).and_return(true) allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:all_caught_up?).and_return(all_caught_up)
expect(::Gitlab::Database::LoadBalancing::Sticking).to receive(:unstick_or_continue_sticking).and_call_original end
end
context 'on secondary that has caught up to primary' do
it 'continues to use the secondary' do it 'continues to use the secondary' do
expect(session.use_primary?).to be false expect(session.use_primary?).to be false
expect(subject.match?).to be true expect(subject.match?).to be true
...@@ -61,44 +62,17 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do ...@@ -61,44 +62,17 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
end end
context 'on secondary behind primary' do context 'on secondary behind primary' do
before do let(:all_caught_up) { false }
allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:all_caught_up?).and_return(false)
end
context 'with feature flag disabled' do
before do
stub_feature_flags(matching_merge_request_db_sync: false)
expect(::Gitlab::Database::LoadBalancing).not_to receive(:enable?)
expect(::Gitlab::Database::LoadBalancing::Sticking).not_to receive(:unstick_or_continue_sticking)
end
it 'does not check load balancing state' do it 'sticks to the primary' do
expect(subject.match?).to be true expect(subject.match?).to be true
end expect(session.use_primary?).to be true
it 'increments no counters' do
expect { subject.match? }
.to change { total_counter.get }.by(0)
.and change { stale_counter.get }.by(0)
end
end end
context 'load balancing enabled' do it 'increments both total and stale counters' do
before do expect { subject.match? }
expect(::Gitlab::Database::LoadBalancing).to receive(:enable?).and_return(true) .to change { total_counter.get }.by(1)
expect(::Gitlab::Database::LoadBalancing::Sticking).to receive(:unstick_or_continue_sticking).and_call_original .and change { stale_counter.get }.by(1)
end
it 'sticks to the primary' do
expect(subject.match?).to be true
expect(session.use_primary?).to be true
end
it 'increments both total and stale counters' do
expect { subject.match? }
.to change { total_counter.get }.by(1)
.and change { stale_counter.get }.by(1)
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