pgsql: pgstat: Acquire lock when reading variable-numbered stats

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pgstat: Acquire lock when reading variable-numbered stats
Date: 2022-08-23 03:20:16
Message-ID: E1oQKSd-000mm1-27@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)mit(dot)edu>
Reviewed-by: "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Author: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAM-w4HMYkM_DkYhWtUGV+qE_rrBxKOzOF0+5faozxO3vXrc9wA@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(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2022-08-23 03:30:52 pgsql: Add BackendType for standalone backends
Previous Message John Naylor 2022-08-23 02:58:49 Re: pgsql: Refer to replication origin roident as "ID" in user facing messa