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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cd063344fb801a90a40923a5b8aefe4eb8d80762

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(+)

Reply via email to