8000 pg_walsummary: Improve stability of test checking statistics · postgres/postgres@330db57 · GitHub
[go: up one dir, main page]

Skip to content

Commit 330db57

Browse files
committed
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 f4694e0, so backpatch down to v18. Reported-by: Alexander Lakhin <exclusion@gmail.com> Reviewed-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/f35ba3db-fca7-4693-bc35-6db64488e4b1@gmail.com Backpatch-through: 18
1 parent 9a5334c commit 330db57

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/bin/pg_walsummary/t/002_blocks.pl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@
4747
ok($result, "WAL summarization caught up after insert");
4848

4949
# The WAL summarizer should have generated some IO statistics.
50-
my $stats_reads = $node1->safe_psql(
50+
$node1->poll_query_until(
5151
'postgres',
52-
qq{SELECT sum(reads) > 0 FROM pg_stat_io
53-
WHERE backend_type = 'walsummarizer' AND object = 'wal'});
54-
is($stats_reads, 't', "WAL summarizer generates statistics for WAL reads");
52+
q{SELECT sum(reads) > 0 FROM pg_stat_io
53+
WHERE backend_type = 'walsummarizer' AND object = 'wal'})
54+
or die
55+
"Timed out while waiting for WAL summarizer to generate statistics for WAL reads";
5556

5657
# Find the highest LSN that is summarized on disk.
5758
my $summarized_lsn = $node1->safe_psql('postgres', <<EOM);

0 commit comments

Comments
 (0)
0