mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Merge branch 'master' of github.com:CyberDem0n/governor into features/refactoring
This commit is contained in:
@@ -150,10 +150,12 @@ class Postgresql:
|
||||
if not self.is_running():
|
||||
logger.warning('Postgresql is not running.')
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def is_healthiest_node(self, members):
|
||||
def is_healthiest_node(self, last_leader_operation, members):
|
||||
if (last_leader_operation or 0) - self.xlog_position() > self.config.get('maximum_lag_on_failover', 0):
|
||||
return False
|
||||
|
||||
for member in members:
|
||||
if member.hostname == self.name:
|
||||
continue
|
||||
@@ -266,3 +268,6 @@ primary_conninfo = '{}'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM pg_replication_slots
|
||||
WHERE slot_name = %s)""", slot, slot)
|
||||
self.members = members
|
||||
|
||||
def last_operation(self):
|
||||
return self.query("SELECT pg_current_xlog_location() - '0/00000'::pg_lsn").fetchone()[0]
|
||||
|
||||
Reference in New Issue
Block a user