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

Commit538d114

Browse files
committed
Allow executor nodes to change their ExecProcNode function.
In order for executor nodes to be able to change their ExecProcNode functionafter ExecInitNode() has finished, provide ExecSetExecProcNode(). This allowsany wrappers functions that only execProcnode.c knows about to be reinstalled.The motivation for wanting to change ExecProcNode after ExecInitNode() hasfinished is that it is not known until later whether parallel query isavailable, so if a parallel variant is to be installed then ExecInitNode()is too soon to decide.Author: Thomas MunroReviewed-By: Andres FreundDiscussion:https://postgr.es/m/CAEepm=09rr65VN+cAV5FgyM_z=D77Xy8Fuc9CDDDYbq3pQUezg@mail.gmail.com
1 parentdbb3d6f commit538d114

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

‎src/backend/executor/execProcnode.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,7 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
370370
break;
371371
}
372372

373-
/*
374-
* Add a wrapper around the ExecProcNode callback that checks stack depth
375-
* during the first execution.
376-
*/
377-
result->ExecProcNodeReal=result->ExecProcNode;
378-
result->ExecProcNode=ExecProcNodeFirst;
373+
ExecSetExecProcNode(result,result->ExecProcNode);
379374

380375
/*
381376
* Initialize any initPlans present in this node. The planner put them in
@@ -401,6 +396,27 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
401396
}
402397

403398

399+
/*
400+
* If a node wants to change its ExecProcNode function after ExecInitNode()
401+
* has finished, it should do so with this function. That way any wrapper
402+
* functions can be reinstalled, without the node having to know how that
403+
* works.
404+
*/
405+
void
406+
ExecSetExecProcNode(PlanState*node,ExecProcNodeMtdfunction)
407+
{
408+
/*
409+
* Add a wrapper around the ExecProcNode callback that checks stack depth
410+
* during the first execution and maybe adds an instrumentation
411+
* wrapper. When the callback is changed after execution has already begun
412+
* that means we'll superflously execute ExecProcNodeFirst, but that seems
413+
* ok.
414+
*/
415+
node->ExecProcNodeReal=function;
416+
node->ExecProcNode=ExecProcNodeFirst;
417+
}
418+
419+
404420
/*
405421
* ExecProcNode wrapper that performs some one-time checks, before calling
406422
* the relevant node method (possibly via an instrumentation wrapper).

‎src/include/executor/executor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ extern void EvalPlanQualEnd(EPQState *epqstate);
219219
* functions in execProcnode.c
220220
*/
221221
externPlanState*ExecInitNode(Plan*node,EState*estate,inteflags);
222+
externvoidExecSetExecProcNode(PlanState*node,ExecProcNodeMtdfunction);
222223
externNode*MultiExecProcNode(PlanState*node);
223224
externvoidExecEndNode(PlanState*node);
224225
externboolExecShutdownNode(PlanState*node);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp