mirror of
https://github.com/postgres/postgres.git
synced 2025-12-24 06:01:07 +03:00
In pg_upgrade, only lock the old cluster if link mode is used, and do it
right after we restore the schema (a common failure point), and right before we do the link operation. Per suggesgtions from Robert and ^!C^!^@lvaro
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -176,14 +184,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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user