summaryrefslogtreecommitdiff
path: root/contrib/pg_upgrade/pg_upgrade.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pg_upgrade/pg_upgrade.c')
-rw-r--r--contrib/pg_upgrade/pg_upgrade.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/contrib/pg_upgrade/pg_upgrade.c b/contrib/pg_upgrade/pg_upgrade.c
index 15b30fc0de0..3078bcd4cd0 100644
--- a/contrib/pg_upgrade/pg_upgrade.c
+++ b/contrib/pg_upgrade/pg_upgrade.c
@@ -43,7 +43,6 @@
#include <langinfo.h>
#endif
-static void disable_old_cluster(void);
static void prepare_new_cluster(void);
static void prepare_new_databases(void);
static void create_new_objects(void);
@@ -87,7 +86,6 @@ main(int argc, char **argv)
pg_log(PG_REPORT, "\nPerforming Upgrade\n");
pg_log(PG_REPORT, "------------------\n");
- disable_old_cluster();
prepare_new_cluster();
stop_postmaster(false);
@@ -109,6 +107,16 @@ main(int argc, char **argv)
stop_postmaster(false);
+ /*
+ * Most failures happen in create_new_objects(), which has
+ * completed at this point. We do this here because it is just
+ * before linking, which will link the old and new cluster data
+ * files, preventing the old cluster from being safely started
+ * once the new cluster is started.
+ */
+ if (user_opts.transfer_mode == TRANSFER_MODE_LINK)
+ disable_old_cluster();
+
transfer_all_new_dbs(&old_cluster.dbarr, &new_cluster.dbarr,
old_cluster.pgdata, new_cluster.pgdata);
@@ -177,14 +185,6 @@ setup(char *argv0, bool live_check)
static void
-disable_old_cluster(void)
-{
- /* rename pg_control so old server cannot be accidentally started */
- rename_old_pg_control();
-}
-
-
-static void
prepare_new_cluster(void)
{
/*