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

Reply via email to