diff --git a/src/bin/pg_walsummary/pg_walsummary.c b/src/bin/pg_walsummary/pg_walsummary.c index ad674b7646..07195a603e 100644 --- a/src/bin/pg_walsummary/pg_walsummary.c +++ b/src/bin/pg_walsummary/pg_walsummary.c @@ -134,12 +134,6 @@ dump_one_relation(ws_options *opt, RelFileLocator *rlocator, BlockNumber startblock = InvalidBlockNumber; BlockNumber endblock = InvalidBlockNumber; - /* Dump limit block, if any. */ - if (limit_block != InvalidBlockNumber) - printf("TS %u, DB %u, REL %u, FORK %s: limit %u\n", - rlocator->spcOid, rlocator->dbOid, rlocator->relNumber, - forkNames[forknum], limit_block); - /* If we haven't allocated a block buffer yet, do that now. */ if (block_buffer == NULL) block_buffer = palloc_array(BlockNumber, block_buffer_size); @@ -174,6 +168,12 @@ dump_one_relation(ws_options *opt, RelFileLocator *rlocator, if (opt->quiet) return; + /* Dump limit block, if any. */ + if (limit_block != InvalidBlockNumber) + printf("TS %u, DB %u, REL %u, FORK %s: limit %u\n", + rlocator->spcOid, rlocator->dbOid, rlocator->relNumber, + forkNames[forknum], limit_block); + /* * Sort the returned block numbers. If the block reference table was using * the bitmap representation for a given chunk, the block numbers in that diff --git a/src/bin/pg_walsummary/t/002_blocks.pl b/src/bin/pg_walsummary/t/002_blocks.pl index bebc1137c0..19689e71da 100644 --- a/src/bin/pg_walsummary/t/002_blocks.pl +++ b/src/bin/pg_walsummary/t/002_blocks.pl @@ -46,6 +46,22 @@ SELECT EXISTS ( EOM ok($result, "WAL summarization caught up after insert"); +# --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'); + +command_checks_all( + [ 'pg_walsummary', '-q', @summaries ], + 0, + [qr/\A\z/], + [qr/\A\z/], + "-q suppresses all output"); + # The WAL summarizer should have generated some IO statistics. $node1->poll_query_until( 'postgres',