Skip to content

Commit b550682

Browse files
committed
Do CHECK_FOR_INTERRUPTS inside, not before, scanGetItem.
The CHECK_FOR_INTERRUPTS call in gingetbitmap turns out to be inadequate to prevent a long uninterruptible loop, because we now know a case where looping occurs within scanGetItem. While the next patch will fix the bug that caused that, it seems foolish to assume that no similar patterns are possible. Let's do the CFI within scanGetItem's retry loop, instead. This demonstrably allows canceling out of the loop exhibited in bug #19031. Bug: #19031 Reported-by: Tim Wood <washwithcare@gmail.com> Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/19031-0638148643d25548@postgresql.org Backpatch-through: 13
1 parent 5f6f951 commit b550682

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/access/gin/ginget.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,8 @@ scanGetItem(IndexScanDesc scan, ItemPointerData advancePast,
13271327
*/
13281328
do
13291329
{
1330+
CHECK_FOR_INTERRUPTS();
1331+
13301332
ItemPointerSetMin(item);
13311333
match = true;
13321334
for (i = 0; i < so->nkeys && match; i++)
@@ -1966,8 +1968,6 @@ gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
19661968

19671969
for (;;)
19681970
{
1969-
CHECK_FOR_INTERRUPTS();
1970-
19711971
if (!scanGetItem(scan, iptr, &iptr, &recheck))
19721972
break;
19731973

0 commit comments

Comments
 (0)