pgsql: Clarify nbtree parallel scan _bt_endpoint contract.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Clarify nbtree parallel scan _bt_endpoint contract.
Date: 2024-11-04 14:06:09
Message-ID: E1t7xib-0008kG-9L@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2024-11-04 14:19:26 Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Previous Message Alexander Korotkov 2024-11-04 14:02:08 Re: pgsql: Implement pg_wal_replay_wait() stored procedure