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: nbtree: Use raw PageAddItem() for retail inserts.
Date: Thu, 19 Mar 2020 01:17:59 +0000
Message-ID: <E1jEjot-0003XJ-6M@gemulon.postgresql.org> (raw)

nbtree: Use raw PageAddItem() for retail inserts.

Only internal page splits need to call _bt_pgaddtup() instead of
PageAddItem(), and only for data items, one of which will end up at the
first offset (or first offset after the high key offset) on the new
right page.  This data item alone will need to be truncated in
_bt_pgaddtup().

Since there is no reason why retail inserts ever need to truncate the
incoming item, use a raw PageAddItem() call there instead.  Even
_bt_split() uses raw PageAddItem() calls for left page and right page
high keys.  Clearly the _bt_pgaddtup() shim function wasn't really
encapsulating anything.  _bt_pgaddtup() should now be thought of as a
_bt_split() helper function.

Note that the assertions from commit d1e241c2 verify that retail inserts
never insert an item at an internal page's negative infinity offset.
This invariant could only ever be violated as a result of a basic logic
error in nbtinsert.c.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6312c08a291fc34068571ec64ee439f2674d739a

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



Message-ID: <E1jEjot-0003XJ-6M@gemulon.postgresql.org>
Permalink:  ../E1jEjot-0003XJ-6M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jEjot-0003XJ-6M@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: nbtree: Use raw PageAddItem() for retail inserts.
  In-Reply-To: <E1jEjot-0003XJ-6M@gemulon.postgresql.org>
  References: <E1jEjot-0003XJ-6M@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