From 2a99dfa15b1cb91fd3c01ad08f9716562c8c1acc Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 6 Mar 2018 22:35:51 +0900 Subject: [PATCH] repmgrd: fix failover handling in "manual" mode Regression was introduced in commit c7a585c55553e0a62ca378d7e2d8a88fdec4e78e --- repmgrd-physical.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/repmgrd-physical.c b/repmgrd-physical.c index 841d97a8..de44cb43 100644 --- a/repmgrd-physical.c +++ b/repmgrd-physical.c @@ -1476,7 +1476,7 @@ do_primary_failover(void) failover_state = promote_self(); } - else if (election_result == ELECTION_LOST) + else if (election_result == ELECTION_LOST || election_result == ELECTION_NOT_CANDIDATE) { log_info(_("follower node awaiting notification from the candidate node")); failover_state = FAILOVER_STATE_WAITING_NEW_PRIMARY; @@ -1492,7 +1492,7 @@ do_primary_failover(void) /* TODO: rerun election if new primary doesn't appear after timeout */ - /* either follow or time out; either way resume monitoring */ + /* either follow, self-promote or time out; either way resume monitoring */ if (wait_primary_notification(&new_primary_id) == true) { /* if primary has reappeared, no action needed */ @@ -1543,11 +1543,9 @@ do_primary_failover(void) &config_file_options, local_node_info.node_id, "standby_disconnect_manual", - - /* - * here "true" indicates the action has occurred as - * expected - */ + /* + * here "true" indicates the action has occurred as expected + */ true, event_details.data); PQfinish(new_primary_conn);