pgsql: Assert consistency of currPage that ended scan. - Mailing list pgsql-committers

From Peter Geoghegan
Subject pgsql: Assert consistency of currPage that ended scan.
Date
Msg-id E1t9Wd5-000sav-9K@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: pgsql: Fix our Windows stat() emulation to handle file sizes > 4GB.
Next
From: Tom Lane
Date:
Subject: pgsql: First-draft release notes for 17.1.