Commit e1d14699 authored by Valery Sizov's avatar Valery Sizov

Add a warning for Postgresql < 9.6 when show replication status

parent 995999cc
......@@ -18,6 +18,9 @@
%strong exact order
they appear.
- unless Gitlab::Database.pg_stat_wal_receiver_supported?
%p.alert.text-danger WARNING: Please upgrade Postgresql to version 9.6 or greater as the status of the streaming cannot be determined realiable enough in this version
- if @nodes.any?
#js-geo-nodes{ data: { primary_version: "#{Gitlab::VERSION}", primary_revision: "#{Gitlab::REVISION}", node_details_path: "#{admin_geo_nodes_path}", node_actions_allowed: "#{Gitlab::Database.read_write?}", node_edit_allowed: "#{Gitlab::Geo.license_allows?}" } }
- else
......
......@@ -7,7 +7,7 @@ module Gitlab
return '' unless Gitlab::Geo.secondary?
return 'The Geo database configuration file is missing.' unless Gitlab::Geo.geo_database_configured?
return 'The Geo node has a database that is not configured for streaming replication with the primary node.' unless self.database_secondary?
return 'The Geo node does not appear to be replicating data from the primary node.' unless self.streaming_active?
return 'The Geo node does not appear to be replicating data from the primary node.' if Gitlab::Database.pg_stat_wal_receiver_supported? && !self.streaming_active?
database_version = self.get_database_version.to_i
migration_version = self.get_migration_version.to_i
......
......@@ -219,6 +219,12 @@ namespace :geo do
puts GeoNode.current_node_url
puts '-----------------------------------------------------'.color(:yellow)
unless Gitlab::Database.pg_stat_wal_receiver_supported?
puts
puts 'WARNING: Please upgrade Postgresql to version 9.6 or greater as the status of the streaming cannot be determined realiable enough for this version'.color(:red)
puts
end
print 'GitLab version: '.rjust(COLUMN_WIDTH)
puts Gitlab::VERSION
......
......@@ -54,6 +54,10 @@ module Gitlab
postgresql? && version.to_f >= 9.4
end
def self.pg_stat_wal_receiver_supported?
postgresql? && version.to_f >= 9.6
end
def self.nulls_last_order(field, direction = 'ASC')
order = "#{field} #{direction}"
......
......@@ -67,12 +67,21 @@ describe Gitlab::Geo::HealthCheck, :postgresql do
expect(subject.perform_checks).to match(/Current Geo database version \([0-9]+\) does not match latest migration \([0-9]+\)/)
end
it 'returns an error when replication lag is not present' do
it 'returns an error when streaming is not active and Postgresql supports pg_stat_wal_receiver' do
allow(Gitlab::Database).to receive(:pg_stat_wal_receiver_supported?).and_return(true)
allow(described_class).to receive(:database_secondary?).and_return(true)
allow(described_class).to receive(:streaming_active?).and_return(false)
expect(subject.perform_checks).to match(/The Geo node does not appear to be replicating data from the primary node/)
end
it 'returns an error when streaming is not active and Postgresql does not support pg_stat_wal_receiver' do
allow(Gitlab::Database).to receive(:pg_stat_wal_receiver_supported?).and_return(false)
allow(described_class).to receive(:database_secondary?).and_return(true)
allow(described_class).to receive(:streaming_active?).and_return(false)
expect(subject.perform_checks).to be_empty
end
end
describe 'MySQL checks' 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