Content-Length: 266807 | pFad | http://github.com/postgrespro/postgres/commit/ed962fd712bbc0836437c8f789d9152aca5711b5

B0 Ensure that seqscans check for interrupts at least once per page. · postgrespro/postgres@ed962fd · GitHub
Skip to content

Commit ed962fd

Browse files
committed
Ensure that seqscans check for interrupts at least once per page.
If a seqscan encounters many consecutive pages containing only dead tuples, it can remain in the loop in heapgettup for a long time, and there was no CHECK_FOR_INTERRUPTS anywhere in that loop. This meant there were real-world situations where a query would be effectively uncancelable for long stretches. Add a check placed to occur once per page, which should be enough to provide reasonable response time without adding any measurable overhead. Report and patch by Merlin Moncure (though I tweaked it a bit). Back-patch to all supported branches.
1 parent 92a953f commit ed962fd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/access/heap/heapam.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ heapgetpage(HeapScanDesc scan, BlockNumber page)
222222
scan->rs_cbuf = InvalidBuffer;
223223
}
224224

225+
/*
226+
* Be sure to check for interrupts at least once per page. Checks at
227+
* higher code levels won't be able to stop a seqscan that encounters
228+
* many pages' worth of consecutive dead tuples.
229+
*/
230+
CHECK_FOR_INTERRUPTS();
231+
225232
/* read page using selected strategy */
226233
scan->rs_cbuf = ReadBufferExtended(scan->rs_rd, MAIN_FORKNUM, page,
227234
RBM_NORMAL, scan->rs_strategy);

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/ed962fd712bbc0836437c8f789d9152aca5711b5

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy