Content-Length: 263519 | pFad | http://github.com/postgrespro/postgres/commit/caca6d8d276ce57473e97050d19dfe84e59482c8

C3 Assert consistency of currPage that ended scan. · postgrespro/postgres@caca6d8 · GitHub
Skip to content

Commit caca6d8

Browse files
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 b5ee4e5.
1 parent 4225276 commit caca6d8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/access/nbtree/nbtsearch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2230,8 +2230,9 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
22302230
!so->currPos.moreRight : !so->currPos.moreLeft))
22312231
{
22322232
/* most recent _bt_readpage call (for lastcurrblkno) ended scan */
2233+
Assert(so->currPos.currPage == lastcurrblkno && !seized);
22332234
BTScanPosInvalidate(so->currPos);
2234-
_bt_parallel_done(scan);
2235+
_bt_parallel_done(scan); /* iff !so->needPrimScan */
22352236
return false;
22362237
}
22372238

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/caca6d8d276ce57473e97050d19dfe84e59482c8

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy