mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
pg_walsummary: Fix --quiet to suppress limit block output
Previously, pg_walsummary printed limit block lines even with --quiet because the output was generated before checking the quiet flag. Fix this by moving the output after the quiet check. Backpatch to v17, where pg_walsummary was introduced. Author: Koshi Shibagaki <shibagaki.koshi@fujitsu.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/TY5PR01MB18445D1AF87F64E9835BAD0B0FA962@TY5PR01MB18445.jpnprd01.prod.outlook.com Backpatch-through: 17
This commit is contained in:
@@ -135,12 +135,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);
|
||||
@@ -175,6 +169,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
|
||||
|
||||
@@ -46,6 +46,18 @@ 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_like([ 'pg_walsummary', '-q', @summaries ],
|
||||
qr/\A\z/, "-q suppresses all output");
|
||||
|
||||
# Find the highest LSN that is summarized on disk.
|
||||
my $summarized_lsn = $node1->safe_psql('postgres', <<EOM);
|
||||
SELECT MAX(end_lsn) AS summarized_lsn FROM pg_available_wal_summaries()
|
||||
|
||||
Reference in New Issue
Block a user