]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pgstat: Use correct lock level in pgstat_drop_all_entries().
authorAndres Freund <andres@anarazel.de>
Sat, 16 Apr 2022 19:13:31 +0000 (12:13 -0700)
committerAndres Freund <andres@anarazel.de>
Sat, 16 Apr 2022 21:44:58 +0000 (14:44 -0700)
commit4a736a161c306fcfed970e6b649f2f03f465ac24
treed0b93ecb10a1ef84160726e13a150282bbb70bf0
parent9f4f0a0dad4c7422a97d94e4051c08ec6d181dd6
pgstat: Use correct lock level in pgstat_drop_all_entries().

Previously we didn't, which lead to an assertion failure when resetting
partially loaded statistics. This was encountered on the buildfarm, for
as-of-yet unknown reasons.

Ttighten up a validity check when reading the stats file, verifying 'E'
signals the end of the file (rather than just stopping reading). That's then
used in a test appending to the stats file that crashed before the fix in
pgstat_drop_all_entries().

Reported by buildfarm animals mylodon and kestrel, via Tom Lane.

Discussion: https://postgr.es/m/1656446.1650043715@sss.pgh.pa.us
src/backend/utils/activity/pgstat.c
src/backend/utils/activity/pgstat_shmem.c
src/test/recovery/t/029_stats_restart.pl