From e0d6d906e7dd25939e4934ab38b5bd3d86b6e583 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 23 Oct 2018 12:47:55 +0900 Subject: [PATCH] repmgrd: fix upstream role check Only take action if it's confirmed as a standby. --- repmgrd-physical.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/repmgrd-physical.c b/repmgrd-physical.c index a175cf2d..efb065a2 100644 --- a/repmgrd-physical.c +++ b/repmgrd-physical.c @@ -868,7 +868,7 @@ monitor_streaming_standby(void) { primary_conn = upstream_conn; - if (get_recovery_type(primary_conn) != RECTYPE_PRIMARY) + if (get_recovery_type(primary_conn) == RECTYPE_STANDBY) { ExecStatusType ping_result; @@ -1322,7 +1322,7 @@ loop: if (PQstatus(primary_conn) == CONNECTION_OK) { - if (get_recovery_type(primary_conn) != RECTYPE_PRIMARY) + if (get_recovery_type(primary_conn) == RECTYPE_STANDBY) { log_notice(_("current upstream node \"%s\" (node ID: %i) is not primary, restarting monitoring"), upstream_node_info.node_name, upstream_node_info.node_id); @@ -1335,8 +1335,6 @@ loop: } } - log_debug("YYY here3 active ? %c", local_node_info.active ? 't' : 'f'); - /* we've reconnected to the local node after an outage */ if (local_node_info.active == false) {