diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_rewind/RewindTest.pm | 6 | ||||
-rw-r--r-- | src/bin/pg_rewind/pg_rewind.c | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/bin/pg_rewind/RewindTest.pm b/src/bin/pg_rewind/RewindTest.pm index 057b08f9a49..1dce56d0352 100644 --- a/src/bin/pg_rewind/RewindTest.pm +++ b/src/bin/pg_rewind/RewindTest.pm @@ -231,7 +231,8 @@ sub run_pg_rewind 'pg_rewind', "--debug", "--source-pgdata=$standby_pgdata", - "--target-pgdata=$master_pgdata" + "--target-pgdata=$master_pgdata", + "--no-sync" ], 'pg_rewind local'); } @@ -243,7 +244,8 @@ sub run_pg_rewind [ 'pg_rewind', "--debug", "--source-server", $standby_connstr, - "--target-pgdata=$master_pgdata" + "--target-pgdata=$master_pgdata", + "--no-sync" ], 'pg_rewind remote'); } diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index 441e8074b70..96531063869 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -56,6 +56,7 @@ char *connstr_source = NULL; bool debug = false; bool showprogress = false; bool dry_run = false; +bool do_sync = true; /* Target history */ TimeLineHistoryEntry *targetHistory; @@ -71,6 +72,8 @@ usage(const char *progname) printf(_(" --source-pgdata=DIRECTORY source data directory to synchronize with\n")); printf(_(" --source-server=CONNSTR source server to synchronize with\n")); printf(_(" -n, --dry-run stop before modifying anything\n")); + printf(_(" -N, --no-sync do not wait for changes to be written\n")); + printf(_(" safely to disk\n")); printf(_(" -P, --progress write progress messages\n")); printf(_(" --debug write a lot of debug messages\n")); printf(_(" -V, --version output version information, then exit\n")); @@ -89,6 +92,7 @@ main(int argc, char **argv) {"source-server", required_argument, NULL, 2}, {"version", no_argument, NULL, 'V'}, {"dry-run", no_argument, NULL, 'n'}, + {"no-sync", no_argument, NULL, 'N'}, {"progress", no_argument, NULL, 'P'}, {"debug", no_argument, NULL, 3}, {NULL, 0, NULL, 0} @@ -125,7 +129,7 @@ main(int argc, char **argv) } } - while ((c = getopt_long(argc, argv, "D:nP", long_options, &option_index)) != -1) + while ((c = getopt_long(argc, argv, "D:nNP", long_options, &option_index)) != -1) { switch (c) { @@ -141,6 +145,10 @@ main(int argc, char **argv) dry_run = true; break; + case 'N': + do_sync = false; + break; + case 3: debug = true; break; @@ -709,7 +717,7 @@ updateControlFile(ControlFileData *ControlFile) static void syncTargetDirectory(const char *argv0) { - if (dry_run) + if (!do_sync || dry_run) return; fsync_pgdata(datadir_target, progname, PG_VERSION_NUM); |