Clarify nbtree parallel scan _bt_endpoint contract.
_bt_endpoint is a helper function for _bt_first that's called whenever
no useful insertion scan key can be used, and we need to lock and read
either the leftmost or rightmost leaf page in the index. Simplify and
document its preconditions, relieving its _bt_first caller from having
to end the parallel scan when it returns false.
Also stop unnecessarily invalidating the current scan position in nearby
code in both _bt_first and _bt_endpoint. This seems to have been
copy-pasted from _bt_readnextpage, where invalidating the scan's current
position really is necessary.
Follow-up to the refactoring work in commit 1bd4bc85.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/62620b6aadcedf453989e6b426f6ef3284c64bed
Modified Files
--------------
src/backend/access/nbtree/nbtree.c | 4 +++-
src/backend/access/nbtree/nbtsearch.c | 40 ++++++++++++-----------------------
2 files changed, 17 insertions(+), 27 deletions(-)