Commit 5159d9fc authored by Yorick Peterse's avatar Yorick Peterse

Merge branch 'sh-fix-ee-load-balancing' into 'master'

Fix EE load balancing crashing on Rails 5

Closes #8692

See merge request gitlab-org/gitlab-ee!8687
parents 371354e8 549e3f76
......@@ -30,7 +30,7 @@ module Gitlab
read_using_load_balancer(:select, args)
end
def select_all(arel, name = nil, binds = [])
def select_all(arel, name = nil, binds = [], preparable: nil)
if arel.respond_to?(:locked) && arel.locked
# SELECT ... FOR UPDATE queries should be sent to the primary.
write_using_load_balancer(:select_all, [arel, name, binds],
......
......@@ -12,6 +12,13 @@ describe Gitlab::Database::LoadBalancing::ConnectionProxy do
end
describe '#select_all' do
let(:override_proxy) { ActiveRecord::Base.connection.class }
# We can't use :Gitlab::Utils::Override because this method is dynamically prepended
it 'method signatures match', :rails5 do
expect(proxy.method(:select_all).parameters).to eq(override_proxy.instance_method(:select_all).parameters)
end
describe 'using a SELECT query' do
it 'runs the query on a secondary' do
arel = double(:arel)
......
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