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

Commitba10eae

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 parent5561404 commitba10eae

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

‎src/backend/executor/execMain.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,8 +1727,12 @@ ExecutePlan(EState *estate,
17271727
*/
17281728
if (TupIsNull(slot))
17291729
{
1730-
/* Allow nodes to release or shut down resources. */
1731-
(void)ExecShutdownNode(planstate);
1730+
/*
1731+
* If we know we won't need to back up, we can release
1732+
* resources at this point.
1733+
*/
1734+
if (!(estate->es_top_eflags&EXEC_FLAG_BACKWARD))
1735+
(void)ExecShutdownNode(planstate);
17321736
break;
17331737
}
17341738

@@ -1774,8 +1778,12 @@ ExecutePlan(EState *estate,
17741778
current_tuple_count++;
17751779
if (numberTuples&&numberTuples==current_tuple_count)
17761780
{
1777-
/* Allow nodes to release or shut down resources. */
1778-
(void)ExecShutdownNode(planstate);
1781+
/*
1782+
* If we know we won't need to back up, we can release
1783+
* resources at this point.
1784+
*/
1785+
if (!(estate->es_top_eflags&EXEC_FLAG_BACKWARD))
1786+
(void)ExecShutdownNode(planstate);
17791787
break;
17801788
}
17811789
}

‎src/backend/executor/nodeLimit.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,14 @@ ExecLimit(PlanState *pstate)
134134
node->position-node->offset >=node->count)
135135
{
136136
node->lstate=LIMIT_WINDOWEND;
137-
/* Allow nodes to release or shut down resources. */
138-
(void)ExecShutdownNode(outerPlan);
137+
138+
/*
139+
* If we know we won't need to back up, we can release
140+
* resources at this point.
141+
*/
142+
if (!(node->ps.state->es_top_eflags&EXEC_FLAG_BACKWARD))
143+
(void)ExecShutdownNode(outerPlan);
144+
139145
returnNULL;
140146
}
141147

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp