1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

test_custom_stats: Stabilize test for counters

After 44539786b8, variable-sized stats updates are batched in one
backend.  A later safe_psql() can check the counters before that backend
has finished flushing its pending stats during shutdown, so force a
flush before checking them.

This is only needed before this report check because
test_custom_stats_var_update() uses pgstat_prep_pending_entry(), leaving
counter updates as backend-local pending stats.

Per buildfarm member mamba.  This could be reproduced locally by slowing
down pgstat_shutdown_hook().

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Sami Imseih <samimseih.pg@gmail.com>
Discussion: https://postgr.es/m/193326.1792282194@sss.pgh.pa.us
This commit is contained in:
Michael Paquier
2026-10-19 07:08:24 +09:00
parent 45fc51fcbf
commit 8afc886831

View File

@@ -86,7 +86,8 @@ foreach my $stats_kind (@var_stats_kinds)
q(select test_custom_stats_var_update(name)
from (values ('entry1', 2), ('entry2', 3),
('entry3', 2), ('entry4', 3)) as stats(name, n),
generate_series(1, n)));
generate_series(1, n);
select pg_stat_force_next_flush()));
# Test data reports.
$result = $node->safe_psql('postgres',