v1-0001-pg_waldump-error-out-with-options-follow-and-stat.patch
application/octet-stream
Filename: v1-0001-pg_waldump-error-out-with-options-follow-and-stat.patch
Type: application/octet-stream
Part: 0
Patch
Format: format-patch
Series: patch v1-0001
Subject: pg_waldump:error out with options --follow and --stats
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/pg_waldump.sgml | 10 | 2 |
| src/bin/pg_waldump/pg_waldump.c | 12 | 0 |
From 8b02f81af635357a2ee70d561fc023aa3950e0cb Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Mon, 15 Nov 2021 13:59:44 +0000
Subject: [PATCH v1] pg_waldump:error out with options --follow and --stats
pg_waldump options, --follow or -f(to keep polling once per second
for new WAL to appear) and --stats or -z don't work well together
i.e. the command stucks [1]. This patch emits an error.
---
doc/src/sgml/ref/pg_waldump.sgml | 12 ++++++++++--
src/bin/pg_waldump/pg_waldump.c | 12 ++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/ref/pg_waldump.sgml b/doc/src/sgml/ref/pg_waldump.sgml
index 432254d2d5..b97534ced0 100644
--- a/doc/src/sgml/ref/pg_waldump.sgml
+++ b/doc/src/sgml/ref/pg_waldump.sgml
@@ -95,7 +95,8 @@ PostgreSQL documentation
<listitem>
<para>
After reaching the end of valid WAL, keep polling once per second for
- new WAL to appear.
+ new WAL to appear. Note that <option>--stats</option> cannot be
+ specified with this option.
</para>
</listitem>
</varlistentry>
@@ -200,7 +201,9 @@ PostgreSQL documentation
<para>
Display summary statistics (number and size of records and
full-page images) instead of individual records. Optionally
- generate statistics per-record instead of per-rmgr.
+ generate statistics per-record instead of per-rmgr. Note
+ that <option>--follow</option> cannot be specified with
+ this option.
</para>
</listitem>
</varlistentry>
@@ -261,6 +264,11 @@ PostgreSQL documentation
<literal>.partial</literal>. If those files need to be read, <literal>.partial</literal>
suffix needs to be removed from the file name.
</para>
+
+ <para>
+ Only the specified timeline is displayed (or the default, if none is
+ specified). Records in other timelines are ignored.
+ </para>
</refsect1>
<refsect1>
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index 1e3894b9c4..58d6e4b2bd 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -952,6 +952,18 @@ main(int argc, char **argv)
goto bad_argument;
}
+ /*
+ * Mutually exclusive arguments
+ */
+ if (config.follow && config.stats)
+ {
+ pg_log_error("%s and %s are incompatible options",
+ "--follow", "--stats");
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
+ progname);
+ exit(1);
+ }
+
if (waldir != NULL)
{
/* validate path points to directory */
--
2.25.1