pgsql: Fix minor nbtree page deletion buffer lock issue. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: Fix minor nbtree page deletion buffer lock issue.
Date
Msg-id E1jSSB0-0002GI-F8@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Noah Misch
Date:
Subject: pgsql: In caught-up logical walsender, sleep only in WalSndWaitForWal()
Next
From: Peter Geoghegan
Date:
Subject: pgsql: Fix another minor page deletion buffer lock issue.