[PATCH] pg_walsummary: suppress limit output with --quiet
[PATCH] pg_walsummary: suppress limit output with --quiet
Hi,
I noticed that pg_walsummary can still print limit lines when --quiet is
specified. This happens with summaries containing relation creation or
truncation, for example:
$ pg_walsummary --quiet example.summary
TS 1663, DB 5, REL 16387, FORK main: limit 0
If I understand correctly, --quiet should suppress
all output except errors.
In dump_one_relation(), the limit line is printed before the existing
quiet check. The attached patch adds a quiet check to that output while
preserving parsing and error detection.
The patch also adds TAP coverage for -q and --quiet and checks that a
truncated input file is still rejected. The pg_walsummary tests pass
with the patch.
Feedback would be appreciated.
Koshi Shibagaki
FUJITSU LIMITED
https://www.fujitsu.com/Re: [PATCH] pg_walsummary: suppress limit output with --quiet
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Mon, Oct 5, 2026 at 12:23 PM Koshi Shibagaki (Fujitsu)
wrote:
> Feedback would be appreciated.
Thanks for the patch!
+for my $option ('-q', '--quiet')
Testing both forms with the same input and expected output seems a bit
overkill for this fix, since both set the same flag. Isn't testing just
one of them be sufficient?
+# Quiet mode must still parse every file, including the final checksum.
Isn't this primarily adding test coverage for existing quiet-mode behavior,
rather than testing the bug being fixed? If so, it might be better to leave
this out of the bug-fix patch intended for backpatching. Thought?
Also, this fix should be backpatched to v17, where pg_walsummary was
introduced?
Regards,
--
Fujii Masao
RE: [PATCH] pg_walsummary: suppress limit output with --quiet
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Hi Shibagaki-san,
Good catch!
> In dump_one_relation(), the limit line is printed before the existing
> quiet check. The attached patch adds a quiet check to that output while
> preserving parsing and error detection.
It might be matter of taste, but how about moving printf() after the `if (opt->quiet)`?
The code might be clearer.
> The patch also adds TAP coverage for -q and --quiet and checks that a
> truncated input file is still rejected. The pg_walsummary tests pass
> with the patch.
```
+# --quiet must also suppress limit blocks caused by relation creation.
+my $summary_dir = $node1->data_dir . '/pg_wal/summaries';
+my @summaries = map { "$summary_dir/$_" }
+ sort grep { /^[0-9A-F]{40}\.summary$/ } slurp_dir($summary_dir);
+command_like(
+ [ 'pg_walsummary', @summaries ],
+ qr/: limit 0$/m,
+ 'relation creation produces limit blocks');
+for my $option ('-q', '--quiet')
+{
+ command_checks_all(
+ [ 'pg_walsummary', $option, @summaries ],
+ 0,
+ [qr/\A\z/],
+ [qr/\A\z/],
+ "$option suppresses all output");
+}
```
I feel it's enough to call command_checks_all() once, thought?
Best regards,
Hayato Kuroda
FUJITSU LIMITED
Re: [PATCH] pg_walsummary: suppress limit output with --quiet
Fujii-san, Kuroda-san, Thank you both for reviewing the patch. > Testing both forms with the same input and expected output seems a bit > overkill for this fix, since both set the same flag. Isn't testing just > one of them be sufficient? > I feel it's enough to call command_checks_all() once, thought? Agreed. In v2, I kept only the -q test, so command_checks_all() is called once. > Isn't this primarily adding test coverage for existing quiet-mode behavior, > rather than testing the bug being fixed? If so, it might be better to leave > this out of the bug-fix patch intended for backpatching. Thought? Agreed. I removed the truncated-file test. > It might be matter of taste, but how about moving printf() after the > `if (opt->quiet)`? The code might be clearer. I moved the limit-block printf() after the quiet check. > Also, this fix should be backpatched to v17, where pg_walsummary was > introduced? Agreed. I tested the updated patch against REL_17_STABLE and REL_18_STABLE, and the pg_walsummary test suite passes on both. The patch applies cleanly to REL_18_STABLE. On REL_17_STABLE, the code change applies cleanly, but the test needs a small context adjustment because that branch does not contain the pg_stat_io check. Regards, Koshi Shibagaki FUJITSU LIMITED https://www.fujitsu.com/
Re: [PATCH] pg_walsummary: suppress limit output with --quiet
On Mon, Oct 5, 2026 at 5:46 PM Koshi Shibagaki (Fujitsu) wrote: > Agreed. I tested the updated patch against REL_17_STABLE and > REL_18_STABLE, and the pg_walsummary test suite passes on both. > The patch applies cleanly to REL_18_STABLE. On REL_17_STABLE, the > code change applies cleanly, but the test needs a small context > adjustment because that branch does not contain the pg_stat_io check. Thanks for updating the patch! LGTM. I've attached an updated version with some cosmetic changes and revised commit log messages. I also created a patch for REL_17_STABLE. Barring any objections, I will commit it. Regards, -- Fujii Masao
Re: [PATCH] pg_walsummary: suppress limit output with --quiet
От:
"Koshi Shibagaki (Fujitsu)" <shibagaki.koshi@fujitsu.com>
Дата:
Fujii-san, Thanks for updating the patch and revising the commit log messages. LGTM. No objections from me. Regards, Koshi Shibagaki FUJITSU LIMITED https://www.fujitsu.com/
RE: [PATCH] pg_walsummary: suppress limit output with --quiet
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Dear Fujii-san, > Thanks for updating the patch! LGTM. > > I've attached an updated version with some cosmetic changes and revised > commit log messages. I also created a patch for REL_17_STABLE. Thanks for updating the patch. One minor point: command_like() might be better in below if we assume the command returns 0 and no stderr. But not a strong opinion. ``` +command_checks_all([ 'pg_walsummary', '-q', @summaries ], + 0, [qr/\A\z/], [qr/\A\z/], "-q suppresses all output"); ``` Best regards, Hayato Kuroda FUJITSU LIMITED
Re: [PATCH] pg_walsummary: suppress limit output with --quiet
On Wed, Oct 7, 2026 at 10:56 AM Hayato Kuroda (Fujitsu) wrote: > Thanks for updating the patch. One minor point: command_like() might be > better in below if we assume the command returns 0 and no stderr. But > not a strong opinion. > > ``` > +command_checks_all([ 'pg_walsummary', '-q', @summaries ], > + 0, [qr/\A\z/], [qr/\A\z/], "-q suppresses all output"); > ``` Okay, I've replaced it with command_like(). How about the attached updated patches? Regards, -- Fujii Masao
RE: [PATCH] pg_walsummary: suppress limit output with --quiet
От:
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Дата:
Dear Fujii-san, > Okay, I've replaced it with command_like(). How about the attached updated > patches? Yes, it's same as my expectation. LGTM. Best regards, Hayato Kuroda FUJITSU LIMITED