v3-0001-log-to-say-command-is-executing-in-dry-run-mode.patch
application/octet-stream
Filename: v3-0001-log-to-say-command-is-executing-in-dry-run-mode.patch
Type: application/octet-stream
Part: 1
Patch
Format: format-patch
Series: patch v3-0001
Subject: log to say command is executing in dry run mode
| File | + | − |
|---|---|---|
| src/bin/pg_archivecleanup/pg_archivecleanup.c | 8 | 0 |
| src/bin/pg_basebackup/pg_createsubscriber.c | 9 | 0 |
| src/bin/pg_combinebackup/pg_combinebackup.c | 8 | 0 |
| src/bin/pg_resetwal/pg_resetwal.c | 8 | 0 |
| src/bin/pg_resetwal/t/001_basic.pl | 1 | 1 |
| src/bin/pg_rewind/pg_rewind.c | 12 | 2 |
From 8e52963312fcf4046ddcf6532a1adfe284887d20 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 9 Oct 2025 18:41:37 +1100
Subject: [PATCH v3] log to say command is executing in dry run mode
---
src/bin/pg_archivecleanup/pg_archivecleanup.c | 8 ++++++++
src/bin/pg_basebackup/pg_createsubscriber.c | 9 +++++++++
src/bin/pg_combinebackup/pg_combinebackup.c | 8 ++++++++
src/bin/pg_resetwal/pg_resetwal.c | 8 ++++++++
src/bin/pg_resetwal/t/001_basic.pl | 2 +-
src/bin/pg_rewind/pg_rewind.c | 14 ++++++++++++--
6 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index c25348b..dc12627 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -375,6 +375,14 @@ main(int argc, char **argv)
exit(2);
}
+ if (dryrun)
+ {
+ pg_log_info("-----------------------------------------------------");
+ pg_log_info("Executing in dry-run mode.");
+ pg_log_info("No files will be removed.");
+ pg_log_info("-----------------------------------------------------");
+ }
+
/*
* Check archive exists and other initialization if required.
*/
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index d294074..48df17a 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -2270,6 +2270,15 @@ main(int argc, char **argv)
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit(1);
}
+
+ if (dry_run)
+ {
+ pg_log_info("-----------------------------------------------------");
+ pg_log_info("Executing in dry-run mode.");
+ pg_log_info("The target directory will not be modified.");
+ pg_log_info("-----------------------------------------------------");
+ }
+
pg_log_info("validating publisher connection string");
pub_base_conninfo = get_base_conninfo(opt.pub_conninfo_str,
&dbname_conninfo);
diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index f5cef99..eca33fb 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -241,6 +241,14 @@ main(int argc, char *argv[])
if (opt.no_manifest)
opt.manifest_checksums = CHECKSUM_TYPE_NONE;
+ if (opt.dry_run)
+ {
+ pg_log_info("-----------------------------------------------------");
+ pg_log_info("Executing in dry-run mode.");
+ pg_log_info("The target directory will not be modified.");
+ pg_log_info("-----------------------------------------------------");
+ }
+
/* Check that the platform supports the requested copy method. */
if (opt.copy_method == COPY_METHOD_CLONE)
{
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 7a4e4eb..6533355 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -396,6 +396,14 @@ main(int argc, char *argv[])
exit(1);
}
+ if (noupdate)
+ {
+ printf(_("-----------------------------------------------------"));
+ printf(_("Executing in dry-run mode."));
+ printf(_("Nothing will be modified."));
+ printf(_("-----------------------------------------------------"));
+ }
+
/*
* Attempt to read the existing pg_control file
*/
diff --git a/src/bin/pg_resetwal/t/001_basic.pl b/src/bin/pg_resetwal/t/001_basic.pl
index d6bbbd0..247bd93 100644
--- a/src/bin/pg_resetwal/t/001_basic.pl
+++ b/src/bin/pg_resetwal/t/001_basic.pl
@@ -17,7 +17,7 @@ $node->init;
$node->append_conf('postgresql.conf', 'track_commit_timestamp = on');
command_like([ 'pg_resetwal', '-n', $node->data_dir ],
- qr/checkpoint/, 'pg_resetwal -n produces output');
+ qr/checkpoint/m, 'pg_resetwal -n produces output');
# Permissions on PGDATA should be default
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 0c68dd4..3f90be6 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -300,8 +300,18 @@ main(int argc, char **argv)
atexit(disconnect_atexit);
/*
- * Ok, we have all the options and we're ready to start. First, connect to
- * remote server.
+ * Ok, we have all the options and we're ready to start.
+ */
+ if (dry_run)
+ {
+ pg_log_info("-----------------------------------------------------");
+ pg_log_info("Executing in dry-run mode.");
+ pg_log_info("The target directory will not be modified.");
+ pg_log_info("-----------------------------------------------------");
+ }
+
+ /*
+ * First, connect to remote server.
*/
if (connstr_source)
{
--
1.8.3.1