mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
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
This commit is contained in:
parent
1d6fb35ad6
commit
884a60840c
@ -1486,6 +1486,11 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir)
|
|||||||
if (_bt_readpage(scan, dir, P_FIRSTDATAKEY(opaque)))
|
if (_bt_readpage(scan, dir, P_FIRSTDATAKEY(opaque)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (scan->parallel_scan != NULL)
|
||||||
|
{
|
||||||
|
/* allow next page be processed by parallel worker */
|
||||||
|
_bt_parallel_release(scan, opaque->btpo_next);
|
||||||
|
}
|
||||||
|
|
||||||
/* nope, keep going */
|
/* nope, keep going */
|
||||||
if (scan->parallel_scan != NULL)
|
if (scan->parallel_scan != NULL)
|
||||||
@ -1581,6 +1586,11 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir)
|
|||||||
if (_bt_readpage(scan, dir, PageGetMaxOffsetNumber(page)))
|
if (_bt_readpage(scan, dir, PageGetMaxOffsetNumber(page)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else if (scan->parallel_scan != NULL)
|
||||||
|
{
|
||||||
|
/* allow next page be processed by parallel worker */
|
||||||
|
_bt_parallel_release(scan, BufferGetBlockNumber(so->currPos.buf));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For parallel scans, get the last page scanned as it is quite
|
* For parallel scans, get the last page scanned as it is quite
|
||||||
|
Loading…
x
Reference in New Issue
Block a user