pgstat: Acquire lock when reading variable-numbered stats
Andres Freund <andres@anarazel.de>
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-
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/activity/pgstat.c | modified | +9 −0 |
| src/backend/utils/activity/pgstat_shmem.c | modified | +16 −0 |
| src/include/utils/pgstat_internal.h | modified | +1 −0 |
Discussion
- Re: shared-memory based stats collector - v70 8 messages · 2022-08-08 → 2022-08-23