Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 88c8034

Browse files
committed
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.
1 parent d2bc1c9 commit 88c8034

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

contrib/pg_upgrade/exec.c

+12-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
static void check_data_dir(const char *pg_data);
17-
static void check_bin_dir(ClusterInfo *cluster);
17+
static void check_bin_dir(ClusterInfo *cluster, Cluster whichCluster);
1818
static int check_exec(const char *dir, const char *cmdName);
1919
static const char *validate_exec(const char *path);
2020

@@ -99,15 +99,15 @@ verify_directories(void)
9999
check_ok();
100100

101101
prep_status("Checking old bin directory (%s)", old_cluster.bindir);
102-
check_bin_dir(&old_cluster);
102+
check_bin_dir(&old_cluster, CLUSTER_OLD);
103103
check_ok();
104104

105105
prep_status("Checking new data directory (%s)", new_cluster.pgdata);
106106
check_data_dir(new_cluster.pgdata);
107107
check_ok();
108108

109109
prep_status("Checking new bin directory (%s)", new_cluster.bindir);
110-
check_bin_dir(&new_cluster);
110+
check_bin_dir(&new_cluster, CLUSTER_NEW);
111111
check_ok();
112112
}
113113

@@ -158,12 +158,18 @@ check_data_dir(const char *pg_data)
158158
* exit().
159159
*/
160160
static void
161-
check_bin_dir(ClusterInfo *cluster)
161+
check_bin_dir(ClusterInfo *cluster, Cluster whichCluster)
162162
{
163163
check_exec(cluster->bindir, "postgres");
164-
check_exec(cluster->bindir, "psql");
165164
check_exec(cluster->bindir, "pg_ctl");
166-
check_exec(cluster->bindir, "pg_dumpall");
165+
check_exec(cluster->bindir, "pg_resetxlog");
166+
if (whichCluster == CLUSTER_NEW)
167+
{
168+
/* these are only needed in the new cluster */
169+
check_exec(cluster->bindir, "pg_config");
170+
check_exec(cluster->bindir, "psql");
171+
check_exec(cluster->bindir, "pg_dumpall");
172+
}
167173
}
168174

169175

contrib/pg_upgrade/option.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,11 @@ validateDirectoryOption(char **dirpath,
310310
static void
311311
get_pkglibdirs(void)
312312
{
313-
old_cluster.libpath = get_pkglibdir(old_cluster.bindir);
313+
/*
314+
* we do not need to know the libpath in the old cluster, and might not
315+
* have a working pg_config to ask for it anyway.
316+
*/
317+
old_cluster.libpath = NULL;
314318
new_cluster.libpath = get_pkglibdir(new_cluster.bindir);
315319
}
316320

0 commit comments

Comments
 (0)