RE: [PATCH] pg_walsummary: suppress limit output with --quiet - Mailing list pgsql-hackers

From Hayato Kuroda (Fujitsu)
Subject RE: [PATCH] pg_walsummary: suppress limit output with --quiet
Date
Msg-id OS7PR01MB183176AA5500CEAD3D49092DBF5962@OS7PR01MB18317.jpnprd01.prod.outlook.com
Whole thread
In response to [PATCH] pg_walsummary: suppress limit output with --quiet  ("Koshi Shibagaki (Fujitsu)" <shibagaki.koshi@fujitsu.com>)
Responses Re: [PATCH] pg_walsummary: suppress limit output with --quiet
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: [PATCH] pg_walsummary: suppress limit output with --quiet
Next
From: Nisha Moond
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication