summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginget.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-08-26 11:38:41 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2025-08-26 11:38:41 -0400
commitb55068236c5e92e211a6bbf8816933fdac02da80 (patch)
treec8276f0e1cda51f4a8e86c08a3e17f0fe78f1e71 /src/backend/access/gin/ginget.c
parent5f6f951f88e53630b3ebe9bde762a9612ca6202f (diff)
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
Diffstat (limited to 'src/backend/access/gin/ginget.c')
-rw-r--r--src/backend/access/gin/ginget.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index f29ccd3c2d1..656299b1b52 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -1327,6 +1327,8 @@ scanGetItem(IndexScanDesc scan, ItemPointerData advancePast,
*/
do
{
+ CHECK_FOR_INTERRUPTS();
+
ItemPointerSetMin(item);
match = true;
for (i = 0; i < so->nkeys && match; i++)
@@ -1966,8 +1968,6 @@ gingetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
for (;;)
{
- CHECK_FOR_INTERRUPTS();
-
if (!scanGetItem(scan, iptr, &iptr, &recheck))
break;