aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-12-29 13:43:53 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2010-12-29 13:43:53 -0500
commit88c803457a53d2f83168519f0651e6dc258003b5 (patch)
tree8d2693f56ddbf2c03b70328706d4c5f5f9ff68e0
parentd2bc1c9907115f5773927febf823c8d7ae92155b (diff)
downloadpostgresql-88c803457a53d2f83168519f0651e6dc258003b5.tar.gz
postgresql-88c803457a53d2f83168519f0651e6dc258003b5.zip
Improve pg_upgrade's checks for required executables.
Don't insist on pg_dumpall and psql being present in the old cluster, since they are not needed. Do insist on pg_resetxlog being present (in both old and new), since we need it. Also check for pg_config, but only in the new cluster. Remove the useless attempt to call pg_config in the old cluster; we don't need to know the old value of --pkglibdir. (In the case of a stripped-down migration installation there might be nothing there to look at anyway, so any future change that might reintroduce that need would have to be considered carefully.) Per my attempts to build a minimal previous-version installation to support pg_upgrade.
-rw-r--r--contrib/pg_upgrade/exec.c18
-rw-r--r--contrib/pg_upgrade/option.c6
2 files changed, 17 insertions, 7 deletions
diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c
index 455d7ac45d6..af0fcf93a95 100644
--- a/contrib/pg_upgrade/exec.c
+++ b/contrib/pg_upgrade/exec.c
@@ -14,7 +14,7 @@
static void check_data_dir(const char *pg_data);
-static void check_bin_dir(ClusterInfo *cluster);
+static void check_bin_dir(ClusterInfo *cluster, Cluster whichCluster);
static int check_exec(const char *dir, const char *cmdName);
static const char *validate_exec(const char *path);
@@ -99,7 +99,7 @@ verify_directories(void)
check_ok();
prep_status("Checking old bin directory (%s)", old_cluster.bindir);
- check_bin_dir(&old_cluster);
+ check_bin_dir(&old_cluster, CLUSTER_OLD);
check_ok();
prep_status("Checking new data directory (%s)", new_cluster.pgdata);
@@ -107,7 +107,7 @@ verify_directories(void)
check_ok();
prep_status("Checking new bin directory (%s)", new_cluster.bindir);
- check_bin_dir(&new_cluster);
+ check_bin_dir(&new_cluster, CLUSTER_NEW);
check_ok();
}
@@ -158,12 +158,18 @@ check_data_dir(const char *pg_data)
* exit().
*/
static void
-check_bin_dir(ClusterInfo *cluster)
+check_bin_dir(ClusterInfo *cluster, Cluster whichCluster)
{
check_exec(cluster->bindir, "postgres");
- check_exec(cluster->bindir, "psql");
check_exec(cluster->bindir, "pg_ctl");
- check_exec(cluster->bindir, "pg_dumpall");
+ check_exec(cluster->bindir, "pg_resetxlog");
+ if (whichCluster == CLUSTER_NEW)
+ {
+ /* these are only needed in the new cluster */
+ check_exec(cluster->bindir, "pg_config");
+ check_exec(cluster->bindir, "psql");
+ check_exec(cluster->bindir, "pg_dumpall");
+ }
}
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c
index e63bc85bc1f..f6b57065374 100644
--- a/contrib/pg_upgrade/option.c
+++ b/contrib/pg_upgrade/option.c
@@ -310,7 +310,11 @@ validateDirectoryOption(char **dirpath,
static void
get_pkglibdirs(void)
{
- old_cluster.libpath = get_pkglibdir(old_cluster.bindir);
+ /*
+ * we do not need to know the libpath in the old cluster, and might not
+ * have a working pg_config to ask for it anyway.
+ */
+ old_cluster.libpath = NULL;
new_cluster.libpath = get_pkglibdir(new_cluster.bindir);
}