pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix RBM_ZERO_AND_LOCK.
Date: Mon, 10 Jun 2024 02:08:06 +0000
Message-ID: <E1sGUS5-000orA-Im@gemulon.postgresql.org> (raw)

Fix RBM_ZERO_AND_LOCK.

Commit 210622c6 accidentally zeroed out pages even if they were found in
the buffer pool.  It should always lock the page, but it should only
zero pages that were not already valid.  Otherwise, concurrent readers
that hold only a pin could see corrupted page contents changing under
their feet.

While here, rename ZeroAndLockBuffer() to match the RBM_ flag name.
Also restore a some useful comments lost by 210622c6's refactoring, and
add some new ones to clarify why we need to use the BM_IO_IN_PROGRESS
infrastructure despite not doing I/O.

Reported-by: Noah Misch <noah@leadboat.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> (earlier version)
Reviewed-by: Robert Haas <robertmhaas@gmail.com> (earlier version)
Discussion: https://postgr.es/m/20240512171658.7e.nmisch@google.com
Discussion: https://postgr.es/m/7ed10231-ce47-03d5-d3f9-4aea0dc7d5a4%40gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 88 ++++++++++++++++++++++++++++---------
1 file changed, 67 insertions(+), 21 deletions(-)



Message-ID: <E1sGUS5-000orA-Im@gemulon.postgresql.org>
Permalink:  ../E1sGUS5-000orA-Im@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sGUS5-000orA-Im@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix RBM_ZERO_AND_LOCK.
  In-Reply-To: <E1sGUS5-000orA-Im@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