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 <[email protected]> Reviewed-by: "Drouvot, Bertrand" <[email protected]> Reviewed-by: Andres Freund <[email protected]> Author: Kyotaro Horiguchi <[email protected]> Discussion: https://postgr.es/m/cam-w4hmykm_dkyhwtugv+qe_rrbxkozof0+5faozxo3vxrc...@mail.gmail.com Backpatch: 15- Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/045ec347857b66e8a494b2c12126a6d476702065 Modified Files -------------- src/backend/utils/activity/pgstat.c | 9 +++++++++ src/backend/utils/activity/pgstat_shmem.c | 16 ++++++++++++++++ src/include/utils/pgstat_internal.h | 1 + 3 files changed, 26 insertions(+)
