From d4b457ecad9db7538f718ba4103cafc083768c8f Mon Sep 17 00:00:00 2001 From: Sami Imseih Date: Sun, 18 Oct 2026 02:14:01 +0000 Subject: [PATCH v1 1/1] pgstat: Stabilize test_custom_stats counter checks After 44539786b82, 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. Author: Sami Imseih Discussion: https://postgr.es/m/193326.1792282194@sss.pgh.pa.us --- src/test/modules/test_custom_stats/t/001_custom_stats.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/modules/test_custom_stats/t/001_custom_stats.pl b/src/test/modules/test_custom_stats/t/001_custom_stats.pl index 88dce8caffb..ccda129c4ff 100644 --- a/src/test/modules/test_custom_stats/t/001_custom_stats.pl +++ b/src/test/modules/test_custom_stats/t/001_custom_stats.pl @@ -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', -- 2.50.1