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

Commita87e759

Browse files
committed
Move ModifyTableContext->lockmode to UpdateContext
Should have been done this way to start with, but I failed to noticeThis way we avoid some pointless initialization, and better contains thevariable to exist in the scope where it is really used.Reviewed-by: Michaël Paquier <michael@paquier.xyz>Discussion:https://postgr.es/m/202204191345.qerjy3kxi3eb@alvherre.pgsql
1 parent3dcc6bf commita87e759

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

‎src/backend/executor/nodeModifyTable.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ typedef struct ModifyTableContext
116116
* cross-partition UPDATE
117117
*/
118118
TupleTableSlot*cpUpdateReturningSlot;
119-
120-
/*
121-
* Lock mode to acquire on the latest tuple version before performing
122-
* EvalPlanQual on it
123-
*/
124-
LockTupleModelockmode;
125119
}ModifyTableContext;
126120

127121
/*
@@ -132,6 +126,12 @@ typedef struct UpdateContext
132126
boolupdated;/* did UPDATE actually occur? */
133127
boolupdateIndexes;/* index update required? */
134128
boolcrossPartUpdate;/* was it a cross-partition update? */
129+
130+
/*
131+
* Lock mode to acquire on the latest tuple version before performing
132+
* EvalPlanQual on it
133+
*/
134+
LockTupleModelockmode;
135135
}UpdateContext;
136136

137137

@@ -1971,7 +1971,7 @@ lreplace:;
19711971
estate->es_snapshot,
19721972
estate->es_crosscheck_snapshot,
19731973
true/* wait for commit */ ,
1974-
&context->tmfd,&context->lockmode,
1974+
&context->tmfd,&updateCxt->lockmode,
19751975
&updateCxt->updateIndexes);
19761976
if (result==TM_Ok)
19771977
updateCxt->updated= true;
@@ -2251,7 +2251,7 @@ ExecUpdate(ModifyTableContext *context, ResultRelInfo *resultRelInfo,
22512251
result=table_tuple_lock(resultRelationDesc,tupleid,
22522252
estate->es_snapshot,
22532253
inputslot,estate->es_output_cid,
2254-
context->lockmode,LockWaitBlock,
2254+
updateCxt.lockmode,LockWaitBlock,
22552255
TUPLE_LOCK_FLAG_FIND_LAST_VERSION,
22562256
&context->tmfd);
22572257

@@ -3557,8 +3557,6 @@ ExecModifyTable(PlanState *pstate)
35573557
{
35583558
EvalPlanQualSetSlot(&node->mt_epqstate,context.planSlot);
35593559

3560-
context.lockmode=0;
3561-
35623560
ExecMerge(&context,node->resultRelInfo,NULL,node->canSetTag);
35633561
continue;/* no RETURNING support yet */
35643562
}
@@ -3637,8 +3635,6 @@ ExecModifyTable(PlanState *pstate)
36373635
{
36383636
EvalPlanQualSetSlot(&node->mt_epqstate,context.planSlot);
36393637

3640-
context.lockmode=0;
3641-
36423638
ExecMerge(&context,node->resultRelInfo,NULL,node->canSetTag);
36433639
continue;/* no RETURNING support yet */
36443640
}
@@ -3694,9 +3690,6 @@ ExecModifyTable(PlanState *pstate)
36943690
}
36953691
}
36963692

3697-
/* complete context setup */
3698-
context.lockmode=0;
3699-
37003693
switch (operation)
37013694
{
37023695
caseCMD_INSERT:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp