Skip to content

Commit

Permalink
repmgrd: fix upstream role check
Browse files Browse the repository at this point in the history
Only take action if it's confirmed as a standby.
  • Loading branch information
ibarwick committed Oct 23, 2018
1 parent 79e79bd commit 0cafeb3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions repmgrd-physical.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -1322,7 +1322,7 @@ monitor_streaming_standby(void)

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);
Expand All @@ -1335,8 +1335,6 @@ monitor_streaming_standby(void)
}
}

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)
{
Expand Down

0 comments on commit 0cafeb3

Please sign in to comment.