1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-09 17:03:00 +03:00

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 f4694e0f35, 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
This commit is contained in:
Michael Paquier
2025-07-08 13:48:49 +09:00
parent f54af9f267
commit a27893df45

View File

@@ -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);