Re: pgsql: pgstat: add/extend tests for resetting various kinds of stats.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: pgstat: add/extend tests for resetting various kinds of stats.
Date: 2022-09-15 19:59:52
Message-ID: 3428246.1663271992@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Andres Freund <andres(at)anarazel(dot)de> writes:
> pgstat: add/extend tests for resetting various kinds of stats.

crake just failed [1] with what appears to be a race condition in
a test case added by this commit:

diff -U3 /home/andrew/bf/root/HEAD/pgsql/src/test/regress/expected/stats.out /home/andrew/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/results/stats.out
--- /home/andrew/bf/root/HEAD/pgsql/src/test/regress/expected/stats.out 2022-07-18 13:32:25.155847949 -0400
+++ /home/andrew/bf/root/HEAD/pgsql.build/src/test/recovery/tmp_check/results/stats.out 2022-09-15 12:44:10.022975164 -0400
@@ -563,7 +563,7 @@
SELECT sessions > :db_stat_sessions FROM pg_stat_database WHERE datname = (SELECT current_database());
?column?
----------
- t
+ f
(1 row)

-- Test pg_stat_bgwriter checkpointer-related stats, together with pg_stat_wal

It seems likely to me that the n_sessions increment hasn't made it to
shared memory because some background process happened to have a lock on
the stats entry when we tried. Don't we need a pg_stat_force_next_flush()
call before trying to inspect the sessions count?

BTW, the header comment for pgstat_report_stat is badly in need of
copy-editing.

regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2022-09-15%2016%3A18%3A30

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-09-15 20:48:04 Re: pgsql: aix: No need to use mkldexport when we want to export all symbol
Previous Message Andres Freund 2022-09-15 19:44:22 Re: pgsql: aix: No need to use mkldexport when we want to export all symbol