Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69de171

Browse files
author
Amit Kapila
committed
Prohibit shutting down resources if there is a possibility of back up.
Currently, we release the asynchronous resources as soon as it is evidentthat no more rows will be needed e.g. when a Limit is filled. This can beproblematic especially for custom and foreign scans where we can scanbackward. Fix that by disallowing the shutting down of resources in suchcases.Reported-by: Robert HaasAnalysed-by: Robert Haas and Amit KapilaAuthor: Amit KapilaReviewed-by: Robert HaasBackpatch-through: 9.6 where this code was introducedDiscussion:https://postgr.es/m/86137f17-1dfb-42f9-7421-82fd786b04a1@anayrat.info
1 parent0d428b6 commit69de171

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

‎src/backend/executor/execMain.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,8 +1571,12 @@ ExecutePlan(EState *estate,
15711571
*/
15721572
if (TupIsNull(slot))
15731573
{
1574-
/* Allow nodes to release or shut down resources. */
1575-
(void)ExecShutdownNode(planstate);
1574+
/*
1575+
* If we know we won't need to back up, we can release
1576+
* resources at this point.
1577+
*/
1578+
if (!(estate->es_top_eflags&EXEC_FLAG_BACKWARD))
1579+
(void)ExecShutdownNode(planstate);
15761580
break;
15771581
}
15781582

‎src/backend/executor/nodeLimit.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,14 @@ ExecLimit(LimitState *node)
130130
node->position-node->offset >=node->count)
131131
{
132132
node->lstate=LIMIT_WINDOWEND;
133-
/* Allow nodes to release or shut down resources. */
134-
(void)ExecShutdownNode(outerPlan);
133+
134+
/*
135+
* If we know we won't need to back up, we can release
136+
* resources at this point.
137+
*/
138+
if (!(node->ps.state->es_top_eflags&EXEC_FLAG_BACKWARD))
139+
(void)ExecShutdownNode(outerPlan);
140+
135141
returnNULL;
136142
}
137143

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp