diff options
Diffstat (limited to 'src/bin/pg_upgrade/pg_upgrade.c')
-rw-r--r-- | src/bin/pg_upgrade/pg_upgrade.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index fc66d93dd6a..ca1aa5cbb80 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -48,7 +48,7 @@ static void prepare_new_cluster(void); static void prepare_new_databases(void); static void create_new_objects(void); -static void copy_clog_xlog_xid(void); +static void copy_xact_xlog_xid(void); static void set_frozenxids(bool minmxid_only); static void setup(char *argv0, bool *live_check); static void cleanup(void); @@ -115,7 +115,7 @@ main(int argc, char **argv) * Destructive Changes to New Cluster */ - copy_clog_xlog_xid(); + copy_xact_xlog_xid(); /* New now using xids of the old system */ @@ -376,17 +376,17 @@ remove_new_subdir(char *subdir, bool rmtopdir) * Copy the files from the old cluster into it */ static void -copy_subdir_files(char *subdir) +copy_subdir_files(char *old_subdir, char *new_subdir) { char old_path[MAXPGPATH]; char new_path[MAXPGPATH]; - remove_new_subdir(subdir, true); + remove_new_subdir(new_subdir, true); - snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, subdir); - snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, subdir); + snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, old_subdir); + snprintf(new_path, sizeof(new_path), "%s/%s", new_cluster.pgdata, new_subdir); - prep_status("Copying old %s to new server", subdir); + prep_status("Copying old %s to new server", old_subdir); exec_prog(UTILITY_LOG_FILE, NULL, true, #ifndef WIN32 @@ -401,10 +401,16 @@ copy_subdir_files(char *subdir) } static void -copy_clog_xlog_xid(void) +copy_xact_xlog_xid(void) { - /* copy old commit logs to new data dir */ - copy_subdir_files("pg_clog"); + /* + * Copy old commit logs to new data dir. pg_clog has been renamed to + * pg_xact in post-10 clusters. + */ + copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ? + "pg_clog" : "pg_xact", + GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ? + "pg_clog" : "pg_xact"); /* set the next transaction id and epoch of the new cluster */ prep_status("Setting next transaction ID and epoch for new cluster"); @@ -434,8 +440,8 @@ copy_clog_xlog_xid(void) if (old_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER && new_cluster.controldata.cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER) { - copy_subdir_files("pg_multixact/offsets"); - copy_subdir_files("pg_multixact/members"); + copy_subdir_files("pg_multixact/offsets", "pg_multixact/offsets"); + copy_subdir_files("pg_multixact/members", "pg_multixact/members"); prep_status("Setting next multixact ID and offset for new cluster"); |