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
override :match?
def match?
return super unless ::Feature.enabled?(:matching_merge_request_db_sync, default_enabled: true)
return super unless ::Gitlab::Database::LoadBalancing.enable?
# When a user merges a merge request, the following sequence happens:
......
......@@ -40,14 +40,15 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
context 'with load balancing enabled', :request_store, :redis do
let(:session) { ::Gitlab::Database::LoadBalancing::Session.current }
let(:all_caught_up) { true }
context 'on secondary that has caught up to primary' do
before do
allow(::Gitlab::Database::LoadBalancing::Sticking).to receive(:all_caught_up?).and_return(true)
expect(::Gitlab::Database::LoadBalancing).to receive(:enable?).and_return(true)
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
context 'on secondary that has caught up to primary' do
it 'continues to use the secondary' do
expect(session.use_primary?).to be false
expect(subject.match?).to be true
......@@ -61,33 +62,7 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
end
context 'on secondary behind primary' do
before do
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
expect(subject.match?).to be true
end
it 'increments no counters' do
expect { subject.match? }
.to change { total_counter.get }.by(0)
.and change { stale_counter.get }.by(0)
end
end
context 'load balancing enabled' do
before do
expect(::Gitlab::Database::LoadBalancing).to receive(:enable?).and_return(true)
expect(::Gitlab::Database::LoadBalancing::Sticking).to receive(:unstick_or_continue_sticking).and_call_original
end
let(:all_caught_up) { false }
it 'sticks to the primary' do
expect(subject.match?).to be true
......@@ -102,5 +77,4 @@ RSpec.describe Gitlab::Checks::MatchingMergeRequest do
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