]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pgstat: Acquire lock when reading variable-numbered stats
authorAndres Freund <andres@anarazel.de>
Tue, 23 Aug 2022 03:16:50 +0000 (20:16 -0700)
committerAndres Freund <andres@anarazel.de>
Tue, 23 Aug 2022 03:17:45 +0000 (20:17 -0700)
commit045ec347857b66e8a494b2c12126a6d476702065
tree148fe30dac9b281d1ff7d704ba2b457d9eaff35b
parenta2caf182a2edcee7b1c00036b7dba6762941473c
pgstat: Acquire lock when reading variable-numbered stats

Somewhere during the development of the patch acquiring a lock during read
access to variable-numbered stats got lost. The missing lock acquisition won't
cause corruption, but can lead to reading torn values when accessing
stats. Add the missing lock acquisitions.

Reported-by: Greg Stark <stark@mit.edu>
Reviewed-by: "Drouvot, Bertrand" <bdrouvot@amazon.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/CAM-w4HMYkM_DkYhWtUGV+qE_rrBxKOzOF0+5faozxO3vXrc9wA@mail.gmail.com
Backpatch: 15-
src/backend/utils/activity/pgstat.c
src/backend/utils/activity/pgstat_shmem.c
src/include/utils/pgstat_internal.h