diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 27924159d6..570500824d 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -590,6 +590,9 @@ check_and_dump_old_cluster(bool live_check) get_loadable_libraries(); + /* skip the below check */ + if (user_opts.skip_check) + goto generate_old_dump; /* * Check for various failure cases @@ -660,6 +663,8 @@ check_and_dump_old_cluster(bool live_check) if (GET_MAJOR_VERSION(old_cluster.major_version) <= 905) check_for_pg_role_prefix(&old_cluster); +generate_old_dump: + /* * While not a check option, we do this now because this is the only time * the old server is running. diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c index 548ea4e623..a85b6a96fd 100644 --- a/src/bin/pg_upgrade/option.c +++ b/src/bin/pg_upgrade/option.c @@ -60,6 +60,7 @@ parseCommandLine(int argc, char *argv[]) {"copy", no_argument, NULL, 2}, {"copy-file-range", no_argument, NULL, 3}, {"sync-method", required_argument, NULL, 4}, + {"skip-check", no_argument, NULL, 5}, {NULL, 0, NULL, 0} }; @@ -211,6 +212,9 @@ parseCommandLine(int argc, char *argv[]) exit(1); user_opts.sync_method = pg_strdup(optarg); break; + case 5: + user_opts.skip_check = true; + break; default: fprintf(stderr, _("Try \"%s --help\" for more information.\n"), @@ -289,6 +293,7 @@ usage(void) printf(_(" -B, --new-bindir=BINDIR new cluster executable directory (default\n" " same directory as pg_upgrade)\n")); printf(_(" -c, --check check clusters only, don't change any data\n")); + printf(_(" --skip-check skip the check in actual upgrade \n")); printf(_(" -d, --old-datadir=DATADIR old cluster data directory\n")); printf(_(" -D, --new-datadir=DATADIR new cluster data directory\n")); printf(_(" -j, --jobs=NUM number of simultaneous processes or threads to use\n")); diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index af370768b6..e0071d7725 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -125,6 +125,12 @@ main(int argc, char **argv) setup(argv[0], &live_check); + if (live_check && user_opts.skip_check) + { + pg_fatal("skip-check can't be used in check mode. Please turn off " + "skip-check if you want to perform a live check .\n"); + } + output_check_banner(live_check); check_cluster_versions(); diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h index 8afe240bdf..adf4ab7e1c 100644 --- a/src/bin/pg_upgrade/pg_upgrade.h +++ b/src/bin/pg_upgrade/pg_upgrade.h @@ -327,6 +327,9 @@ typedef struct int jobs; /* number of processes/threads to use */ char *socketdir; /* directory to use for Unix sockets */ char *sync_method; + bool skip_check; /* true -> skip check in actual upgrade, + * assuming the various failure cases are + * impossible. */ } UserOpts; typedef struct