pgsql: Remove unnecessary PageIsEmpty() nbtree build check.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove unnecessary PageIsEmpty() nbtree build check.
Date: 2020-07-06 20:49:08
Message-ID: E1jsY32-0005Zl-7b@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove unnecessary PageIsEmpty() nbtree build check.

nbtree index builds cannot write out an empty page. That would mean
that there was no way to create a pivot tuple pointing to the page one
level up, since _bt_truncate() generates one based on page's firstright
tuple.

Replace the unnecessary PageIsEmpty() check with an assertion that
checks that the page has space for at least two line pointers (the
would-be high key line pointer, plus at least one valid "data item"
tuple line pointer).

The PageIsEmpty() check was added by commit 5d9f146c over 20 years ago.
It looks like it has always been unnecessary.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/28c16f4947df0a98c124ec1724faff629d6c77f7

Modified Files
--------------
src/backend/access/nbtree/nbtsort.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2020-07-07 08:33:28 pgsql: Resolve gratuitous tabs in test SQL file
Previous Message Tom Lane 2020-07-06 18:21:28 pgsql: Create composite array types for initdb-created relations.