Log a note at program start when running in dry-run mode

Users might get some peace of mind knowing their data is not being
destroyed or whatever.

Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAHut+PsvQJQnQO0KT0S2oegenkvJ8FUuY-QS5syyqmT24R2xFQ@mail.gmail.com
pull/248/head
Álvaro Herrera 1 month ago
parent 75e82b2f5a
commit c05dee1911
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
  1. 4
      src/bin/pg_archivecleanup/pg_archivecleanup.c
  2. 5
      src/bin/pg_basebackup/pg_createsubscriber.c
  3. 4
      src/bin/pg_combinebackup/pg_combinebackup.c
  4. 10
      src/bin/pg_rewind/pg_rewind.c

@ -375,6 +375,10 @@ main(int argc, char **argv)
exit(2); exit(2);
} }
if (dryrun)
pg_log_info("Executing in dry-run mode.\n"
"No files will be removed.");
/* /*
* Check archive exists and other initialization if required. * Check archive exists and other initialization if required.
*/ */

@ -2305,6 +2305,11 @@ main(int argc, char **argv)
pg_log_error_hint("Try \"%s --help\" for more information.", progname); pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit(1); exit(1);
} }
if (dry_run)
pg_log_info("Executing in dry-run mode.\n"
"The target directory will not be modified.");
pg_log_info("validating publisher connection string"); pg_log_info("validating publisher connection string");
pub_base_conninfo = get_base_conninfo(opt.pub_conninfo_str, pub_base_conninfo = get_base_conninfo(opt.pub_conninfo_str,
&dbname_conninfo); &dbname_conninfo);

@ -242,6 +242,10 @@ main(int argc, char *argv[])
if (opt.no_manifest) if (opt.no_manifest)
opt.manifest_checksums = CHECKSUM_TYPE_NONE; opt.manifest_checksums = CHECKSUM_TYPE_NONE;
if (opt.dry_run)
pg_log_info("Executing in dry-run mode.\n"
"The target directory will not be modified.");
/* Check that the platform supports the requested copy method. */ /* Check that the platform supports the requested copy method. */
if (opt.copy_method == COPY_METHOD_CLONE) if (opt.copy_method == COPY_METHOD_CLONE)
{ {

@ -300,10 +300,12 @@ main(int argc, char **argv)
atexit(disconnect_atexit); atexit(disconnect_atexit);
/* /* Ok, we have all the options and we're ready to start. */
* Ok, we have all the options and we're ready to start. First, connect to if (dry_run)
* remote server. pg_log_info("Executing in dry-run mode.\n"
*/ "The target directory will not be modified.");
/* First, connect to remote server. */
if (connstr_source) if (connstr_source)
{ {
conn = PQconnectdb(connstr_source); conn = PQconnectdb(connstr_source);

Loading…
Cancel
Save