pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pgstat: Acquire lock when reading variable-numbered stats
Date: Tue, 23 Aug 2022 03:20:16 +0000
Message-ID: <E1oQKSd-000mm0-1f@gemulon.postgresql.org> (raw)

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-

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



view thread (2+ messages)  latest in thread

Message-ID: <E1oQKSd-000mm0-1f@gemulon.postgresql.org>
Permalink:  ../E1oQKSd-000mm0-1f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oQKSd-000mm0-1f@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: pgstat: Acquire lock when reading variable-numbered stats
  In-Reply-To: <E1oQKSd-000mm0-1f@gemulon.postgresql.org>
  References: <E1oQKSd-000mm0-1f@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox