From 9040d53e55555d14f510d501eea8201ccf32aaf2 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 20 Apr 2020 16:46:05 +0900 Subject: [PATCH] standby switchover: note database name for superuser connections It's useful to have a confirmation of which database repmgr is trying to connect to when the -S/--superuser connection is provided. It will always be the database defined in the repmgr.conf "conninfo" parameter, but having the name available is useful when e.g. troubleshooting issues with .pgpass configuration. --- repmgr-action-standby.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 130168af..0413c11b 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -3563,7 +3563,8 @@ do_standby_switchover(void) { if (runtime_options.dry_run == true) { - log_info(_("validating database connection for superuser \"%s\""), runtime_options.superuser); + log_info(_("validating connection to local database for superuser \"%s\""), + runtime_options.superuser); } superuser_conn = establish_db_connection_with_replacement_param( @@ -3573,23 +3574,27 @@ do_standby_switchover(void) if (PQstatus(superuser_conn) != CONNECTION_OK) { - log_error(_("unable to connect as provided superuser \"%s\""), + log_error(_("unable to connect to local database \"%s\" as provided superuser \"%s\""), + PQdb(superuser_conn), runtime_options.superuser); exit(ERR_BAD_CONFIG); } if (is_superuser_connection(superuser_conn, NULL) == false) { - log_error(_("database connection established for provided superuser \"%s\" is not a superuser connection"), + log_error(_("connection established to local database \"%s\" for provided superuser \"%s\" is not a superuser connection"), + PQdb(superuser_conn), runtime_options.superuser); exit(ERR_BAD_CONFIG); } if (runtime_options.dry_run == true) { - log_info(_("successfully established database connection established for provided superuser \"%s\""), + log_info(_("successfully established connection to local database \"%s\" for provided superuser \"%s\""), + PQdb(superuser_conn), runtime_options.superuser); } + } /*