Commit 7a978275 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch '332545-fix-rails-6-1-query-error' into 'master'

Fix query error on Rails 6.1

See merge request gitlab-org/gitlab!63139
parents 2b0996c9 6ea555fa
...@@ -27,7 +27,7 @@ module Postgresql ...@@ -27,7 +27,7 @@ module Postgresql
# We force the use of a transaction here so the query always goes to the # We force the use of a transaction here so the query always goes to the
# primary, even when using the EE DB load balancer. # primary, even when using the EE DB load balancer.
sizes = transaction { pluck(lag_function) } sizes = transaction { pluck(Arel.sql(lag_function)) }
too_great = sizes.compact.count { |size| size >= max } too_great = sizes.compact.count { |size| size >= max }
# If too many replicas are falling behind too much, the availability of a # If too many replicas are falling behind too much, the availability of a
......
...@@ -24,6 +24,10 @@ RSpec.describe Postgresql::ReplicationSlot do ...@@ -24,6 +24,10 @@ RSpec.describe Postgresql::ReplicationSlot do
expect(described_class).to receive(:in_use?).and_return(true) expect(described_class).to receive(:in_use?).and_return(true)
end end
it 'does not raise an exception' do
expect { described_class.lag_too_great? }.not_to raise_error
end
it 'returns true when replication lag is too great' do it 'returns true when replication lag is too great' do
expect(described_class) expect(described_class)
.to receive(:pluck) .to receive(:pluck)
......
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