From 7fad2ed2c87978ce94b848785afa83e4eaf0911e Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 14 Feb 2019 17:22:24 +0900 Subject: [PATCH] standby switchover: improve error output It wasn't clear why repmgr thinks the demotion candidate is not the upstream of the promotion candidate. --- repmgr-action-standby.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 0298b09b..d0516f92 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -3206,10 +3206,20 @@ do_standby_switchover(void) if (local_node_record.upstream_node_id != remote_node_record.node_id) { - log_error(_("local node %i is not a downstream of demotion candidate primary %i"), + log_error(_("local node \"%s\" (ID: %i) is not a downstream of demotion candidate primary \"%s\" (ID: %i)"), + local_node_record.node_name, local_node_record.node_id, + remote_node_record.node_name, remote_node_record.node_id); + if (local_node_record.upstream_node_id == UNKNOWN_NODE_ID) + log_detail(_("local node has no registered upstream node")); + else + log_detail(_("registered upstream node ID is %i"), + local_node_record.upstream_node_id); + + log_hint(_("execute \"repmgr standby register --force\" to update the local node's metadata")); + PQfinish(local_conn); PQfinish(remote_conn);