Commit 57645dbd authored by Fabio Pitino's avatar Fabio Pitino

Merge branch 'ab/geo-replication-slots' into 'master'

Cleanup checks for replication slot in Geo

See merge request gitlab-org/gitlab!36053
parents 2f7d087b 2e216638
......@@ -300,19 +300,19 @@ class GeoNode < ApplicationRecord
end
def replication_slots_count
return unless Gitlab::Database.replication_slots_supported? && primary?
return unless primary?
PgReplicationSlot.count
end
def replication_slots_used_count
return unless Gitlab::Database.replication_slots_supported? && primary?
return unless primary?
PgReplicationSlot.used_slots_count
end
def replication_slots_max_retained_wal_bytes
return unless Gitlab::Database.replication_slots_supported? && primary?
return unless primary?
PgReplicationSlot.max_retained_wal
end
......
......@@ -3,8 +3,6 @@
require 'spec_helper'
RSpec.describe PgReplicationSlot do
if Gitlab::Database.replication_slots_supported?
describe 'with replication slot support' do
it '#max_replication_slots' do
expect(described_class.max_replication_slots).to be >= 0
end
......@@ -49,6 +47,4 @@ RSpec.describe PgReplicationSlot do
expect(slot['retained_bytes']).to be_nil
end
end
end
end
end
......@@ -99,10 +99,6 @@ module Gitlab
version.to_f < 10
end
def self.replication_slots_supported?
version.to_f >= 9.4
end
def self.postgresql_minimum_supported_version?
version.to_f >= MINIMUM_POSTGRES_VERSION
end
......
......@@ -156,20 +156,6 @@ RSpec.describe Gitlab::Database do
end
end
describe '.replication_slots_supported?' do
it 'returns false when using PostgreSQL 9.3' do
allow(described_class).to receive(:version).and_return('9.3.1')
expect(described_class.replication_slots_supported?).to eq(false)
end
it 'returns true when using PostgreSQL 9.4.0 or newer' do
allow(described_class).to receive(:version).and_return('9.4.0')
expect(described_class.replication_slots_supported?).to eq(true)
end
end
describe '.pg_wal_lsn_diff' do
it 'returns old name when using PostgreSQL 9.6' do
allow(described_class).to receive(:version).and_return('9.6')
......
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