diff options
-rw-r--r-- | src/bin/pg_upgrade/check.c | 16 | ||||
-rw-r--r-- | src/bin/pg_upgrade/controldata.c | 9 | ||||
-rw-r--r-- | src/bin/pg_upgrade/info.c | 6 | ||||
-rw-r--r-- | src/bin/pg_upgrade/option.c | 6 | ||||
-rw-r--r-- | src/bin/pg_upgrade/pg_upgrade.h | 2 | ||||
-rw-r--r-- | src/bin/pg_upgrade/server.c | 19 |
6 files changed, 41 insertions, 17 deletions
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 120c9ae2652..3d0fb96187f 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -770,8 +770,12 @@ check_for_prepared_transactions(ClusterInfo *cluster) "FROM pg_catalog.pg_prepared_xacts"); if (PQntuples(res) != 0) - pg_fatal("The %s cluster contains prepared transactions\n", - CLUSTER_NAME(cluster)); + { + if (cluster == &old_cluster) + pg_fatal("The source cluster contains prepared transactions\n"); + else + pg_fatal("The target cluster contains prepared transactions\n"); + } PQclear(res); @@ -1082,8 +1086,12 @@ check_for_pg_role_prefix(ClusterInfo *cluster) "WHERE rolname ~ '^pg_'"); if (PQntuples(res) != 0) - pg_fatal("The %s cluster contains roles starting with 'pg_'\n", - CLUSTER_NAME(cluster)); + { + if (cluster == &old_cluster) + pg_fatal("The source cluster contains roles starting with 'pg_'\n"); + else + pg_fatal("The target cluster contains roles starting with 'pg_'\n"); + } PQclear(res); diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c index 3abef16c815..ca3db1a2f69 100644 --- a/src/bin/pg_upgrade/controldata.c +++ b/src/bin/pg_upgrade/controldata.c @@ -474,9 +474,12 @@ get_control_data(ClusterInfo *cluster, bool live_check) cluster->controldata.ctrl_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER) || !got_date_is_int || !got_data_checksum_version) { - pg_log(PG_REPORT, - "The %s cluster lacks some required control information:\n", - CLUSTER_NAME(cluster)); + if (cluster == &old_cluster) + pg_log(PG_REPORT, + "The source cluster lacks some required control information:\n"); + else + pg_log(PG_REPORT, + "The target cluster lacks some required control information:\n"); if (!got_xid) pg_log(PG_REPORT, " checkpoint next XID\n"); diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c index 6500302c3d4..f7c278b3069 100644 --- a/src/bin/pg_upgrade/info.c +++ b/src/bin/pg_upgrade/info.c @@ -320,7 +320,11 @@ get_db_and_rel_infos(ClusterInfo *cluster) for (dbnum = 0; dbnum < cluster->dbarr.ndbs; dbnum++) get_rel_infos(cluster, &cluster->dbarr.dbs[dbnum]); - pg_log(PG_VERBOSE, "\n%s databases:\n", CLUSTER_NAME(cluster)); + if (cluster == &old_cluster) + pg_log(PG_VERBOSE, "\nsource databases:\n"); + else + pg_log(PG_VERBOSE, "\ntarget databases:\n"); + if (log_opts.verbose) print_db_infos(&cluster->dbarr); } diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c index cb77665cdab..bbe364741ce 100644 --- a/src/bin/pg_upgrade/option.c +++ b/src/bin/pg_upgrade/option.c @@ -405,8 +405,10 @@ adjust_data_dir(ClusterInfo *cluster) /* Must be a configuration directory, so find the real data directory. */ - prep_status("Finding the real data directory for the %s cluster", - CLUSTER_NAME(cluster)); + if (cluster == &old_cluster) + prep_status("Finding the real data directory for the source cluster"); + else + prep_status("Finding the real data directory for the target cluster"); /* * We don't have a data directory yet, so we can't check the PG version, diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h index 13f7ebfe5a2..dae068ed83f 100644 --- a/src/bin/pg_upgrade/pg_upgrade.h +++ b/src/bin/pg_upgrade/pg_upgrade.h @@ -94,8 +94,6 @@ extern char *output_files[]; #define ECHO_BLANK "." #endif -#define CLUSTER_NAME(cluster) ((cluster) == &old_cluster ? "old" : \ - (cluster) == &new_cluster ? "new" : "none") /* OID system catalog preservation added during PG 9.0 development */ #define TABLE_SPACE_SUBDIRS_CAT_VER 201001111 diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c index 23ba6a2e11b..58e35938967 100644 --- a/src/bin/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -285,9 +285,14 @@ start_postmaster(ClusterInfo *cluster, bool throw_error) PQerrorMessage(conn)); if (conn) PQfinish(conn); - pg_fatal("could not connect to %s postmaster started with the command:\n" - "%s\n", - CLUSTER_NAME(cluster), cmd); + if (cluster == &old_cluster) + pg_fatal("could not connect to source postmaster started with the command:\n" + "%s\n", + cmd); + else + pg_fatal("could not connect to target postmaster started with the command:\n" + "%s\n", + cmd); } PQfinish(conn); @@ -297,8 +302,12 @@ start_postmaster(ClusterInfo *cluster, bool throw_error) * running. */ if (!pg_ctl_return) - pg_fatal("pg_ctl failed to start the %s server, or connection failed\n", - CLUSTER_NAME(cluster)); + { + if (cluster == &old_cluster) + pg_fatal("pg_ctl failed to start the source server, or connection failed\n"); + else + pg_fatal("pg_ctl failed to start the target server, or connection failed\n"); + } return true; } |