Commit 8d2dc120 authored by Stan Hu's avatar Stan Hu

Check for streaming replication in GeoNode status

Part of #1929
parent c80b852b
......@@ -4,6 +4,7 @@ module Gitlab
def self.perform_checks
return '' unless Gitlab::Geo.secondary?
return 'The Geo database configuration file is missing.' unless Gitlab::Geo.configured?
return 'The Geo node has a database that is not configured for streaming replication with the primary node.' unless self.database_secondary?
database_version = self.get_database_version.to_i
migration_version = self.get_migration_version.to_i
......@@ -48,6 +49,14 @@ module Gitlab
latest_migration
end
def self.database_secondary?
raise NotImplemented unless Gitlab::Database.postgresql?
ActiveRecord::Base.connection.execute('SELECT pg_is_in_recovery()')
.first
.fetch('pg_is_in_recovery') == 't'
end
end
end
end
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