pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix minor nbtree page deletion buffer lock issue.
Date: Sat, 25 Apr 2020 21:17:30 +0000
Message-ID: <E1jSSB0-0002GI-F8@gemulon.postgresql.org> (raw)

Fix minor nbtree page deletion buffer lock issue.

Avoid accessing the deletion target page's special area during nbtree
page deletion at a point where there is no buffer lock held.  This issue
was detected by a patch that extends Valgrind's memcheck tool to mark
nbtree pages that are unsafe to access (due to not having a buffer lock
or buffer pin) as NOACCESS.

We do hold a buffer pin at this point, and only access the special area,
so the old approach was safe.  Even still, it seems like a good idea to
tighten up the rules in this area.  There is no reason to not simply
insist on always holding a buffer lock (not just a pin) when accessing
nbtree pages.

Update some related comments in passing.

Discussion: https://postgr.es/m/CAH2-WzkLgyN3zBvRZ1pkNJThC=xi_0gpWRUb_45eexLH1+k2_Q@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/nbtree/nbtpage.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)



Message-ID: <E1jSSB0-0002GI-F8@gemulon.postgresql.org>
Permalink:  ../E1jSSB0-0002GI-F8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jSSB0-0002GI-F8@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: pg@bowt.ie
  Subject: Re: pgsql: Fix minor nbtree page deletion buffer lock issue.
  In-Reply-To: <E1jSSB0-0002GI-F8@gemulon.postgresql.org>
  References: <E1jSSB0-0002GI-F8@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