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: Add defensive "split_only_page" nbtree assertion.
Date: Tue, 14 Apr 2020 04:11:36 +0000
Message-ID: <E1jOCvA-0004On-6Q@gemulon.postgresql.org> (raw)

Add defensive "split_only_page" nbtree assertion.

Clearly it's not okay for nbtree to split a page that is the only page
on its level, and then find that it has to split the parent one level up
in turn.  There is simply no code to handle the split_only_page case in
the _bt_insertonpg() "newitem won't fit" branch (only the "newitem fits"
branch handles split_only_page).  Add a defensive assertion that will
fail if a split_only_page call to _bt_insertonpg() somehow ends up
splitting the target/parent page.

I (pgeoghegan) believe that we don't need split_only_page handling for
the "newitem won't fit" branch because anybody calling _bt_insertonpg()
like this would have to hold a lock on the same one and only child page.

Branch
------
master

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

Modified Files
--------------
src/backend/access/nbtree/nbtinsert.c | 2 ++
1 file changed, 2 insertions(+)



Message-ID: <E1jOCvA-0004On-6Q@gemulon.postgresql.org>
Permalink:  ../E1jOCvA-0004On-6Q@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jOCvA-0004On-6Q@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: Add defensive "split_only_page" nbtree assertion.
  In-Reply-To: <E1jOCvA-0004On-6Q@gemulon.postgresql.org>
  References: <E1jOCvA-0004On-6Q@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