Commit 3848ff31 authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Remove replica selection change FF

Drops :load_balancing_improved_caught_up_hosts_check.
The change should improve picking replica over primary even if not all
replicas are caught, which we required previously.

Changelog: performance
parent 3feae782
---
name: load_balancing_improved_caught_up_hosts_check
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65248
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334989
milestone: '14.1'
type: development
group: group::memory
default_enabled: false
......@@ -147,14 +147,9 @@ module Gitlab
raise 'Failed to determine the write location of the primary database'
end
# FF disabled: Returns true if all hosts have caught up to the given transaction write location.
# FF enabled: Returns true if there was at least one host that has caught up with the given transaction and sets it.
# Returns true if there was at least one host that has caught up with the given transaction and sets it.
def all_caught_up?(location)
if ::Feature.enabled?(:load_balancing_improved_caught_up_hosts_check)
select_up_to_date_host(location)
else
@host_list.hosts.all? { |host| host.caught_up?(location) }
end
end
# Returns true if there was at least one host that has caught up with the given transaction.
......
......@@ -312,30 +312,6 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do
expect(lb.all_caught_up?('foo')).to eq(true)
end
context 'when :load_balancing_improved_caught_up_hosts_check FF is disabled' do
before do
stub_feature_flags(load_balancing_improved_caught_up_hosts_check: false)
end
it 'returns true if all hosts caught up to the write location' do
expect(lb.host_list.hosts).to all(receive(:caught_up?).with('foo').and_return(true))
expect(lb.all_caught_up?('foo')).to eq(true)
end
it 'returns false if a host has not yet caught up' do
expect(lb.host_list.hosts[0]).to receive(:caught_up?)
.with('foo')
.and_return(true)
expect(lb.host_list.hosts[1]).to receive(:caught_up?)
.with('foo')
.and_return(false)
expect(lb.all_caught_up?('foo')).to eq(false)
end
end
end
describe '#retry_with_backoff' do
......
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