aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2019-11-16 10:04:52 +1300
committerThomas Munro <tmunro@postgresql.org>2019-11-16 10:19:16 +1300
commitbc049d0d460aead528ace909a3477bc701ab2e9a (patch)
treeec92a21cbea066ca105a3a9f366f88d0d34fc313
parentd66e68207e998c9b6180bee5fb55019f35fdacf4 (diff)
downloadpostgresql-bc049d0d460aead528ace909a3477bc701ab2e9a.tar.gz
postgresql-bc049d0d460aead528ace909a3477bc701ab2e9a.zip
Always call ExecShutdownNode() if appropriate.
Call ExecShutdownNode() after ExecutePlan()'s loop, rather than at each break. We had forgotten to do that in one case. The omission caused intermittent "temporary file leak" warnings from multi-batch parallel hash joins with a LIMIT clause. Back-patch to 11. Though the problem exists in theory in earlier parallel query releases, nothing really depended on it. Author: Kyotaro Horiguchi Reviewed-by: Thomas Munro, Amit Kapila Discussion: https://postgr.es/m/20191111.212418.2222262873417235945.horikyota.ntt%40gmail.com
-rw-r--r--src/backend/executor/execMain.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 0abb620050b..de9aaf3f766 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -1727,15 +1727,7 @@ ExecutePlan(EState *estate,
* process so we just end the loop...
*/
if (TupIsNull(slot))
- {
- /*
- * If we know we won't need to back up, we can release resources
- * at this point.
- */
- if (!(estate->es_top_eflags & EXEC_FLAG_BACKWARD))
- (void) ExecShutdownNode(planstate);
break;
- }
/*
* If we have a junk filter, then project a new tuple with the junk
@@ -1778,17 +1770,16 @@ ExecutePlan(EState *estate,
*/
current_tuple_count++;
if (numberTuples && numberTuples == current_tuple_count)
- {
- /*
- * If we know we won't need to back up, we can release resources
- * at this point.
- */
- if (!(estate->es_top_eflags & EXEC_FLAG_BACKWARD))
- (void) ExecShutdownNode(planstate);
break;
- }
}
+ /*
+ * If we know we won't need to back up, we can release resources at this
+ * point.
+ */
+ if (!(estate->es_top_eflags & EXEC_FLAG_BACKWARD))
+ (void) ExecShutdownNode(planstate);
+
if (use_parallel_mode)
ExitParallelMode();
}