repmgrd: fix upstream role check

Only take action if it's confirmed as a standby.
This commit is contained in:
Ian Barwick
2018-10-23 12:47:55 +09:00
parent dc8ffd30c6
commit e0d6d906e7

View File

@@ -868,7 +868,7 @@ monitor_streaming_standby(void)
{ {
primary_conn = upstream_conn; primary_conn = upstream_conn;
if (get_recovery_type(primary_conn) != RECTYPE_PRIMARY) if (get_recovery_type(primary_conn) == RECTYPE_STANDBY)
{ {
ExecStatusType ping_result; ExecStatusType ping_result;
@@ -1322,7 +1322,7 @@ loop:
if (PQstatus(primary_conn) == CONNECTION_OK) 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"), log_notice(_("current upstream node \"%s\" (node ID: %i) is not primary, restarting monitoring"),
upstream_node_info.node_name, upstream_node_info.node_id); 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 */ /* we've reconnected to the local node after an outage */
if (local_node_info.active == false) if (local_node_info.active == false)
{ {