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: Reconsider nbtree page deletion assertion.
Date: Tue, 19 May 2020 22:06:59 +0000
Message-ID: <E1jbAO3-0003Y0-HH@gemulon.postgresql.org> (raw)

Reconsider nbtree page deletion assertion.

Commit 624686abcf8 added an assertion that verified that _bt_search
successfully relocated the leaf page undergoing deletion.  Page deletion
cannot deal with the case where the descent stack is to the right of the
page, so this seemed critical (deletion can only handle the case where
the descent stack is to the left of the leaf/target page).  However, the
assertion went a bit too far.

Since only a buffer pin is held on the leaf page throughout the call to
_bt_search, nothing guarantees that it can't have split during this
small window.  And if does actually split, _bt_search may end up
"relocating" a page to the right of the original target leaf page.  This
scenario seems extremely unlikely, but it must still be considered.
Remove the assertion, and document how we cope in this scenario.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/67b0b2dbf947c2308050e49b4591a4bb0e9650fd

Modified Files
--------------
src/backend/access/nbtree/nbtpage.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)



Message-ID: <E1jbAO3-0003Y0-HH@gemulon.postgresql.org>
Permalink:  ../E1jbAO3-0003Y0-HH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jbAO3-0003Y0-HH@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: Reconsider nbtree page deletion assertion.
  In-Reply-To: <E1jbAO3-0003Y0-HH@gemulon.postgresql.org>
  References: <E1jbAO3-0003Y0-HH@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