Commit bc12858f authored by Aleksei Lipniagov's avatar Aleksei Lipniagov

Deprecate load_balancer#all_caught_up? method

The method is just an alias after FF removal. We could drop it.
parent 3848ff31
...@@ -147,11 +147,6 @@ module Gitlab ...@@ -147,11 +147,6 @@ module Gitlab
raise 'Failed to determine the write location of the primary database' raise 'Failed to determine the write location of the primary database'
end end
# 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)
select_up_to_date_host(location)
end
# Returns true if there was at least one host that has caught up with the given transaction. # Returns true if there was at least one host that has caught up with the given transaction.
# #
# In case of a retry, this method also stores the set of hosts that have caught up. # In case of a retry, this method also stores the set of hosts that have caught up.
......
...@@ -33,10 +33,10 @@ module Gitlab ...@@ -33,10 +33,10 @@ module Gitlab
return true unless location return true unless location
load_balancer.all_caught_up?(location).tap do |caught_up| load_balancer.select_up_to_date_host(location).tap do |found|
ActiveSupport::Notifications.instrument('caught_up_replica_pick.load_balancing', { result: caught_up } ) ActiveSupport::Notifications.instrument('caught_up_replica_pick.load_balancing', { result: found } )
unstick(namespace, id) if caught_up unstick(namespace, id) if found
end end
end end
......
...@@ -306,14 +306,6 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do ...@@ -306,14 +306,6 @@ RSpec.describe Gitlab::Database::LoadBalancing::LoadBalancer, :request_store do
end end
end end
describe '#all_caught_up?' do
it 'delegates execution to #select_up_to_date_host' do
expect(lb).to receive(:select_up_to_date_host).with('foo').and_return(true)
expect(lb.all_caught_up?('foo')).to eq(true)
end
end
describe '#retry_with_backoff' do describe '#retry_with_backoff' do
it 'returns the value returned by the block' do it 'returns the value returned by the block' do
value = lb.retry_with_backoff { 10 } value = lb.retry_with_backoff { 10 }
......
...@@ -64,7 +64,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do ...@@ -64,7 +64,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.with(:user, 42) .with(:user, 42)
.and_return(nil) .and_return(nil)
expect(lb).not_to receive(:all_caught_up?) expect(lb).not_to receive(:select_up_to_date_host)
expect(described_class.all_caught_up?(:user, 42)).to eq(true) expect(described_class.all_caught_up?(:user, 42)).to eq(true)
end end
...@@ -72,7 +72,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do ...@@ -72,7 +72,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
context 'when all secondaries have caught up' do context 'when all secondaries have caught up' do
before do before do
allow(lb).to receive(:all_caught_up?).with('foo').and_return(true) allow(lb).to receive(:select_up_to_date_host).with('foo').and_return(true)
end end
it 'returns true, and unsticks' do it 'returns true, and unsticks' do
...@@ -93,7 +93,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do ...@@ -93,7 +93,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
context 'when the secondaries have not yet caught up' do context 'when the secondaries have not yet caught up' do
before do before do
allow(lb).to receive(:all_caught_up?).with('foo').and_return(false) allow(lb).to receive(:select_up_to_date_host).with('foo').and_return(false)
end end
it 'returns false' do it 'returns false' do
...@@ -123,7 +123,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do ...@@ -123,7 +123,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.with(:user, 42) .with(:user, 42)
.and_return(nil) .and_return(nil)
expect(lb).not_to receive(:all_caught_up?) expect(lb).not_to receive(:select_up_to_date_host)
described_class.unstick_or_continue_sticking(:user, 42) described_class.unstick_or_continue_sticking(:user, 42)
end end
...@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do ...@@ -133,7 +133,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.with(:user, 42) .with(:user, 42)
.and_return('foo') .and_return('foo')
allow(lb).to receive(:all_caught_up?).with('foo').and_return(true) allow(lb).to receive(:select_up_to_date_host).with('foo').and_return(true)
expect(described_class).to receive(:unstick).with(:user, 42) expect(described_class).to receive(:unstick).with(:user, 42)
...@@ -145,7 +145,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do ...@@ -145,7 +145,7 @@ RSpec.describe Gitlab::Database::LoadBalancing::Sticking, :redis do
.with(:user, 42) .with(:user, 42)
.and_return('foo') .and_return('foo')
allow(lb).to receive(:all_caught_up?).with('foo').and_return(false) allow(lb).to receive(:select_up_to_date_host).with('foo').and_return(false)
expect(Gitlab::Database::LoadBalancing::Session.current) expect(Gitlab::Database::LoadBalancing::Session.current)
.to receive(:use_primary!) .to receive(:use_primary!)
......
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