From 17f30ec36406fee7ed9cc1983a4abbee97745497 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 11 Jul 2018 15:11:20 +0900 Subject: [PATCH] repmgrd: add additional local node connection check It's possible there are corner-cases where do_election() is called while the local connection is invalid, so perform an additional check. --- repmgrd-physical.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repmgrd-physical.c b/repmgrd-physical.c index 55af0e78..286ba9ab 100644 --- a/repmgrd-physical.c +++ b/repmgrd-physical.c @@ -1539,8 +1539,15 @@ loop: static bool do_primary_failover(void) { + ElectionResult election_result; + + /* + * Double-check status of the local connection + */ + check_connection(&local_node_info, &local_conn); + /* attempt to initiate voting process */ - ElectionResult election_result = do_election(); + election_result = do_election(); /* TODO add pre-event notification here */ failover_state = FAILOVER_STATE_UNKNOWN;