Skip to content
Snippets Groups Projects
Commit 253c8afc authored by Andres Freund's avatar Andres Freund
Browse files

Properly check interrupts in execScan.c.

During the development of d47cfef7 the CFI()s in ExecScan() were
moved back and forth, ending up in the wrong place. Thus queries that
largely spend their time in ExecScan(), and have neither projection
nor a qual, can't be cancelled in a timely manner.

Reported-By: Jeff Janes
Author: Andres Freund
Discussion: https://postgr.es/m/CAMkU=1weDXp8eLLPt9SO1LEUsJYYK9cScaGhLKpuN+WbYo9b5g@mail.gmail.com
Backpatch: 10, as d47cfef7
parent 68a7c24f
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ static bool tlist_matches_tupdesc(PlanState *ps, List *tlist, Index varno, Tuple ...@@ -27,7 +27,7 @@ static bool tlist_matches_tupdesc(PlanState *ps, List *tlist, Index varno, Tuple
/* /*
* ExecScanFetch -- fetch next potential tuple * ExecScanFetch -- check interrupts & fetch next potential tuple
* *
* This routine is concerned with substituting a test tuple if we are * This routine is concerned with substituting a test tuple if we are
* inside an EvalPlanQual recheck. If we aren't, just execute * inside an EvalPlanQual recheck. If we aren't, just execute
...@@ -40,6 +40,8 @@ ExecScanFetch(ScanState *node, ...@@ -40,6 +40,8 @@ ExecScanFetch(ScanState *node,
{ {
EState *estate = node->ps.state; EState *estate = node->ps.state;
CHECK_FOR_INTERRUPTS();
if (estate->es_epqTuple != NULL) if (estate->es_epqTuple != NULL)
{ {
/* /*
...@@ -133,6 +135,8 @@ ExecScan(ScanState *node, ...@@ -133,6 +135,8 @@ ExecScan(ScanState *node,
projInfo = node->ps.ps_ProjInfo; projInfo = node->ps.ps_ProjInfo;
econtext = node->ps.ps_ExprContext; econtext = node->ps.ps_ExprContext;
/* interrupt checks are in ExecScanFetch */
/* /*
* If we have neither a qual to check nor a projection to do, just skip * If we have neither a qual to check nor a projection to do, just skip
* all the overhead and return the raw scan tuple. * all the overhead and return the raw scan tuple.
...@@ -157,8 +161,6 @@ ExecScan(ScanState *node, ...@@ -157,8 +161,6 @@ ExecScan(ScanState *node,
{ {
TupleTableSlot *slot; TupleTableSlot *slot;
CHECK_FOR_INTERRUPTS();
slot = ExecScanFetch(node, accessMtd, recheckMtd); slot = ExecScanFetch(node, accessMtd, recheckMtd);
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment