Skip to content

Commit 837255c

Browse files
committed
pg_upgrade i18n: Fix "%s server/cluster" wording
The original wording was impossible to translate correctly. Discussion: https://postgr.es/m/20170523002827.lzc2jkzh2gubclqb@alvherre.pgsql
1 parent decb08e commit 837255c

File tree

6 files changed

+41
-17
lines changed

6 files changed

+41
-17
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,12 @@ check_for_prepared_transactions(ClusterInfo *cluster)
770770
"FROM pg_catalog.pg_prepared_xacts");
771771

772772
if (PQntuples(res) != 0)
773-
pg_fatal("The %s cluster contains prepared transactions\n",
774-
CLUSTER_NAME(cluster));
773+
{
774+
if (cluster == &old_cluster)
775+
pg_fatal("The source cluster contains prepared transactions\n");
776+
else
777+
pg_fatal("The target cluster contains prepared transactions\n");
778+
}
775779

776780
PQclear(res);
777781

@@ -1082,8 +1086,12 @@ check_for_pg_role_prefix(ClusterInfo *cluster)
10821086
"WHERE rolname ~ '^pg_'");
10831087

10841088
if (PQntuples(res) != 0)
1085-
pg_fatal("The %s cluster contains roles starting with 'pg_'\n",
1086-
CLUSTER_NAME(cluster));
1089+
{
1090+
if (cluster == &old_cluster)
1091+
pg_fatal("The source cluster contains roles starting with 'pg_'\n");
1092+
else
1093+
pg_fatal("The target cluster contains roles starting with 'pg_'\n");
1094+
}
10871095

10881096
PQclear(res);
10891097

src/bin/pg_upgrade/controldata.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,12 @@ get_control_data(ClusterInfo *cluster, bool live_check)
474474
cluster->controldata.ctrl_ver >= LARGE_OBJECT_SIZE_PG_CONTROL_VER) ||
475475
!got_date_is_int || !got_data_checksum_version)
476476
{
477-
pg_log(PG_REPORT,
478-
"The %s cluster lacks some required control information:\n",
479-
CLUSTER_NAME(cluster));
477+
if (cluster == &old_cluster)
478+
pg_log(PG_REPORT,
479+
"The source cluster lacks some required control information:\n");
480+
else
481+
pg_log(PG_REPORT,
482+
"The target cluster lacks some required control information:\n");
480483

481484
if (!got_xid)
482485
pg_log(PG_REPORT, " checkpoint next XID\n");

src/bin/pg_upgrade/info.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,11 @@ get_db_and_rel_infos(ClusterInfo *cluster)
320320
for (dbnum = 0; dbnum < cluster->dbarr.ndbs; dbnum++)
321321
get_rel_infos(cluster, &cluster->dbarr.dbs[dbnum]);
322322

323-
pg_log(PG_VERBOSE, "\n%s databases:\n", CLUSTER_NAME(cluster));
323+
if (cluster == &old_cluster)
324+
pg_log(PG_VERBOSE, "\nsource databases:\n");
325+
else
326+
pg_log(PG_VERBOSE, "\ntarget databases:\n");
327+
324328
if (log_opts.verbose)
325329
print_db_infos(&cluster->dbarr);
326330
}

src/bin/pg_upgrade/option.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,10 @@ adjust_data_dir(ClusterInfo *cluster)
405405

406406
/* Must be a configuration directory, so find the real data directory. */
407407

408-
prep_status("Finding the real data directory for the %s cluster",
409-
CLUSTER_NAME(cluster));
408+
if (cluster == &old_cluster)
409+
prep_status("Finding the real data directory for the source cluster");
410+
else
411+
prep_status("Finding the real data directory for the target cluster");
410412

411413
/*
412414
* We don't have a data directory yet, so we can't check the PG version,

src/bin/pg_upgrade/pg_upgrade.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ extern char *output_files[];
9494
#define ECHO_BLANK "."
9595
#endif
9696

97-
#define CLUSTER_NAME(cluster) ((cluster) == &old_cluster ? "old" : \
98-
(cluster) == &new_cluster ? "new" : "none")
9997

10098
/* OID system catalog preservation added during PG 9.0 development */
10199
#define TABLE_SPACE_SUBDIRS_CAT_VER 201001111

src/bin/pg_upgrade/server.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,14 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
285285
PQerrorMessage(conn));
286286
if (conn)
287287
PQfinish(conn);
288-
pg_fatal("could not connect to %s postmaster started with the command:\n"
289-
"%s\n",
290-
CLUSTER_NAME(cluster), cmd);
288+
if (cluster == &old_cluster)
289+
pg_fatal("could not connect to source postmaster started with the command:\n"
290+
"%s\n",
291+
cmd);
292+
else
293+
pg_fatal("could not connect to target postmaster started with the command:\n"
294+
"%s\n",
295+
cmd);
291296
}
292297
PQfinish(conn);
293298

@@ -297,8 +302,12 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
297302
* running.
298303
*/
299304
if (!pg_ctl_return)
300-
pg_fatal("pg_ctl failed to start the %s server, or connection failed\n",
301-
CLUSTER_NAME(cluster));
305+
{
306+
if (cluster == &old_cluster)
307+
pg_fatal("pg_ctl failed to start the source server, or connection failed\n");
308+
else
309+
pg_fatal("pg_ctl failed to start the target server, or connection failed\n");
310+
}
302311

303312
return true;
304313
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy