pgsql: Assert consistency of currPage that ended scan.

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Assert consistency of currPage that ended scan.
Date: 2024-11-08 21:34:55
Message-ID: E1t9Wd5-000sav-9K@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Assert consistency of currPage that ended scan.

When _bt_readnextpage is called with our nbtree parallel scan already
seized (i.e. when it is directly called by _bt_first), we never expect a
prior call to _bt_readpage for lastcurrblkno to already indicate that
the scan should end -- the _bt_first caller's blkno must always be read.
After all, the "prior" _bt_readpage call (the call for lastcurrblkno)
probably took place in some other backend (and it might not even have
finished by the time our backend reaches _bt_first/_bt_readnextpage).

Add a documenting assertion to the path where _bt_readnextpage ends the
parallel scan based on information about lastcurrblkno from so->currPos.
Assert that the most recent _bt_readpage call that set so->currPos is in
fact lastcurrblkno's _bt_readpage call.

Follow-up to bugfix commit b5ee4e52.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/caca6d8d276ce57473e97050d19dfe84e59482c8

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2024-11-08 21:39:45 pgsql: First-draft release notes for 17.1.
Previous Message Andrew Dunstan 2024-11-08 20:31:54 Re: pgsql: Fix our Windows stat() emulation to handle file sizes > 4GB.