From 8b02f81af635357a2ee70d561fc023aa3950e0cb Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy 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 After reaching the end of valid WAL, keep polling once per second for - new WAL to appear. + new WAL to appear. Note that cannot be + specified with this option. @@ -200,7 +201,9 @@ PostgreSQL documentation 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 cannot be specified with + this option. @@ -261,6 +264,11 @@ PostgreSQL documentation .partial. If those files need to be read, .partial suffix needs to be removed from the file name. + + + Only the specified timeline is displayed (or the default, if none is + specified). Records in other timelines are ignored. + 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