pgsql: Reconsider nbtree page deletion assertion. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: Reconsider nbtree page deletion assertion.
Date
Msg-id E1jbAO3-0003Y0-HH@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: WITH TIES: number of rows is optional and defaults to one
Next
From: noreply@postgresql.org
Date:
Subject: pgsql: Tag refs/tags/REL_13_BETA1 was created