From bd07a3447245de11686361f9cc7e4e0984627b12 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 6 Sep 2017 10:15:52 +0900 Subject: [PATCH] "standby clone": improve log messages Make it clearer which nodes are being connected to, and why. --- dbutils.c | 6 +++--- repmgr-action-standby.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/dbutils.c b/dbutils.c index ccced061..d9510a46 100644 --- a/dbutils.c +++ b/dbutils.c @@ -1094,7 +1094,7 @@ _get_primary_connection(PGconn *conn, } /* find all registered nodes */ - log_verbose(LOG_INFO, _("retrieving node list")); + log_verbose(LOG_INFO, _("searching for primary node")); initPQExpBuffer(&query); appendPQExpBuffer(&query, @@ -1125,7 +1125,7 @@ _get_primary_connection(PGconn *conn, node_id = atoi(PQgetvalue(res, i, 0)); strncpy(remote_conninfo, PQgetvalue(res, i, 1), MAXCONNINFO); log_verbose(LOG_INFO, - _("checking role of node %i"), + _("checking if node %i is primary"), node_id); if (quiet) @@ -1158,7 +1158,7 @@ _get_primary_connection(PGconn *conn, if (recovery_type == RECTYPE_PRIMARY) { PQclear(res); - log_debug(_("get_primary_connection(): current primary node is %i"), node_id); + log_verbose(LOG_INFO, _("current primary node is %i"), node_id); if (primary_id != NULL) { diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 7321e22f..9c45975e 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -212,8 +212,10 @@ do_standby_clone(void) if (runtime_options.no_upstream_connection == false) { /* - * This performs sanity checks on the upstream node, also - * sets "recovery_conninfo_str" and "upstream_repluser" + * This connects to the source node and performs sanity checks, also + * sets "recovery_conninfo_str", "upstream_repluser" and "upstream_node_id". + * + * Will error out if source connection not possible and not in "barman" mode. */ check_source_server(); } @@ -437,6 +439,15 @@ do_standby_clone(void) if (runtime_options.dry_run == true) { + if (upstream_node_id != UNKNOWN_NODE_ID) + { + log_notice(_("standby will attach to upstream node %i"), upstream_node_id); + } + else + { + log_warning(_("unable to determine a valid upstream node id")); + } + if (mode == pg_basebackup && runtime_options.fast_checkpoint == false) { log_hint(_("consider using the -c/--fast-checkpoint option"));