Skip to content

Commit 884a608

Browse files
committed
Fix parallel index scan hang with deleted or half-dead pages.
The previous coding forgot to release the scan before seizing it again, leading to a lockup. Report by Patrick Hemmer. Diagnosis by Thomas Munro. Patch by Amit Kapila. Discussion: http://postgr.es/m/CAEepm=2xZUcOGP9V0O_G0=2P2wwXwPrkF=upWTCJSisUxMnuSg@mail.gmail.com
1 parent 1d6fb35 commit 884a608

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/backend/access/nbtree/nbtsearch.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,11 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir)
14861486
if (_bt_readpage(scan, dir, P_FIRSTDATAKEY(opaque)))
14871487
break;
14881488
}
1489+
else if (scan->parallel_scan != NULL)
1490+
{
1491+
/* allow next page be processed by parallel worker */
1492+
_bt_parallel_release(scan, opaque->btpo_next);
1493+
}
14891494

14901495
/* nope, keep going */
14911496
if (scan->parallel_scan != NULL)
@@ -1581,6 +1586,11 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir)
15811586
if (_bt_readpage(scan, dir, PageGetMaxOffsetNumber(page)))
15821587
break;
15831588
}
1589+
else if (scan->parallel_scan != NULL)
1590+
{
1591+
/* allow next page be processed by parallel worker */
1592+
_bt_parallel_release(scan, BufferGetBlockNumber(so->currPos.buf));
1593+
}
15841594

15851595
/*
15861596
* For parallel scans, get the last page scanned as it is quite

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy