]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix race condition in stats.sql added in 5264add7847
authorAndres Freund <andres@anarazel.de>
Fri, 16 Sep 2022 17:07:12 +0000 (10:07 -0700)
committerAndres Freund <andres@anarazel.de>
Fri, 16 Sep 2022 18:28:20 +0000 (11:28 -0700)
commit32914d900f90f7f5238a3856e67f6bc5bf05e1d9
tree1a7ae2891ceee9073cec36ac320e6d773fd4410b
parentbfd6b3bc4e19db19289ae92a17799edae2cdd5f3
Fix race condition in stats.sql added in 5264add7847

Very occasionally the stats test failed due to the number of sessions not
being updated yet. Likely this requires that there is contention on the
database's stats entry. Solve this by forcing pending stats to be flushed
before fetching the stats.

I verified that there are no other test failures after making
pgstat_report_stat() only flush stats when force = true.

Per message from Tom Lane and buildfarm member crake.

Discussion: https://postgr.es/m/3428246.1663271992@sss.pgh.pa.us
Backpatch: 15-, where 5264add7847 added the test
src/test/regress/expected/stats.out
src/test/regress/sql/stats.sql