summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2025-07-08 04:48:49 +0000
committerMichael Paquier2025-07-08 04:48:49 +0000
commita27893df45ec5d8c657899202e9cf0b9a816fe2f (patch)
tree20d38cf700394c5c7a2c417fd4d35457074fc818
parentf54af9f2679d5987b4680e742ac9bd585260e620 (diff)
pg_walsummary: Improve stability of test checking statistics
Per buildfarm member culicidae, the query checking for stats reported by the WAL summarizer related to WAL reads is proving to be unstable. Instead of a one-time query, this commit replaces the logic with a polling query checking for the WAL read stats, making the test more reliable on machines that could be slow with the stats reports. This test has been introduced in f4694e0f35b2, so backpatch down to v18. Reported-by: Alexander Lakhin <[email protected]> Reviewed-by: Alexander Lakhin <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 18
-rw-r--r--src/bin/pg_walsummary/t/002_blocks.pl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bin/pg_walsummary/t/002_blocks.pl b/src/bin/pg_walsummary/t/002_blocks.pl
index 270332780a4..0f98c7df82e 100644
--- a/src/bin/pg_walsummary/t/002_blocks.pl
+++ b/src/bin/pg_walsummary/t/002_blocks.pl
@@ -47,11 +47,12 @@ EOM
ok($result, "WAL summarization caught up after insert");
# The WAL summarizer should have generated some IO statistics.
-my $stats_reads = $node1->safe_psql(
+$node1->poll_query_until(
'postgres',
- qq{SELECT sum(reads) > 0 FROM pg_stat_io
- WHERE backend_type = 'walsummarizer' AND object = 'wal'});
-is($stats_reads, 't', "WAL summarizer generates statistics for WAL reads");
+ q{SELECT sum(reads) > 0 FROM pg_stat_io
+ WHERE backend_type = 'walsummarizer' AND object = 'wal'})
+ or die
+ "Timed out while waiting for WAL summarizer to generate statistics for WAL reads";
# Find the highest LSN that is summarized on disk.
my $summarized_lsn = $node1->safe_psql('postgres', <<EOM);