pgsql: Reconsider nbtree page deletion assertion.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reconsider nbtree page deletion assertion.
Date: 2020-05-19 22:06:59
Message-ID: E1jbAO3-0003Y0-HH@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message noreply 2020-05-19 22:15:39 pgsql: Tag refs/tags/REL_13_BETA1 was created
Previous Message Alvaro Herrera 2020-05-18 23:29:55 pgsql: WITH TIES: number of rows is optional and defaults to one