Add dcs_last_seen field to API (#2051)

This field notes the last time (as unix epoch) a cluster member has successfully communicated with the DCS. This is useful to identify and/or analyze network partitions.

Also, expose dcs_last_seen in the MemberStatus class and its from_api_response() method.
This commit is contained in:
Michael Banck
2021-09-22 10:01:35 +02:00
committed by GitHub
parent 80c1127b70
commit 2f31e88bdc
5 changed files with 27 additions and 8 deletions
+2 -1
View File
@@ -54,6 +54,7 @@ class MockHa(object):
state_handler = MockPostgresql()
watchdog = MockWatchdog()
dcs_last_seen = 0
@staticmethod
def is_leader():
@@ -77,7 +78,7 @@ class MockHa(object):
@staticmethod
def fetch_nodes_statuses(members):
return [_MemberStatus(None, True, None, 0, None, {}, False)]
return [_MemberStatus(None, True, None, 0, 0, None, {}, False)]
@staticmethod
def schedule_future_restart(data):
+4 -3
View File
@@ -80,13 +80,14 @@ def get_standby_cluster_initialized_with_only_leader(failover=None, sync=None):
)
def get_node_status(reachable=True, in_recovery=True, timeline=2,
wal_position=10, nofailover=False, watchdog_failed=False):
def get_node_status(reachable=True, in_recovery=True, dcs_last_seen=0,
timeline=2, wal_position=10, nofailover=False,
watchdog_failed=False):
def fetch_node_status(e):
tags = {}
if nofailover:
tags['nofailover'] = True
return _MemberStatus(e, reachable, in_recovery, timeline, wal_position, tags, watchdog_failed)
return _MemberStatus(e, reachable, in_recovery, dcs_last_seen, timeline, wal_position, tags, watchdog_failed)
return fetch_node_status