MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecLockRows

Function ExecLockRows

src/backend/executor/nodeLockRows.c:37–282  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecLockRows * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

35 * ----------------------------------------------------------------
36 */
37static TupleTableSlot * /* return: a tuple or NULL */
38ExecLockRows(PlanState *pstate)
39{
40 LockRowsState *node = castNode(LockRowsState, pstate);
41 TupleTableSlot *slot;
42 EState *estate;
43 PlanState *outerPlan;
44 bool epq_needed;
45 ListCell *lc;
46
47 CHECK_FOR_INTERRUPTS();
48
49 /*
50 * get information from the node
51 */
52 estate = node->ps.state;
53 outerPlan = outerPlanState(node);
54
55 /*
56 * Get next tuple from subplan, if any.
57 */
58lnext:
59 slot = ExecProcNode(outerPlan);
60
61 if (TupIsNull(slot))
62 {
63 /* Release any resources held by EPQ mechanism before exiting */
64 EvalPlanQualEnd(&node->lr_epqstate);
65 return NULL;
66 }
67
68 /* We don't need EvalPlanQual unless we get updated tuple version(s) */
69 epq_needed = false;
70
71 /*
72 * Attempt to lock the source tuple(s). (Note we only have locking
73 * rowmarks in lr_arowMarks.)
74 */
75 foreach(lc, node->lr_arowMarks)
76 {
77 ExecAuxRowMark *aerm = (ExecAuxRowMark *) lfirst(lc);
78 ExecRowMark *erm = aerm->rowmark;
79 Datum datum;
80 bool isNull;
81 ItemPointerData tid;
82 TM_FailureData tmfd;
83 LockTupleMode lockmode;
84 int lockflags = 0;
85 TM_Result test;
86 TupleTableSlot *markSlot;
87
88 /* clear any leftover test tuple for this rel */
89 markSlot = EvalPlanQualSlot(&node->lr_epqstate, erm->relation, erm->rti);
90 ExecClearTuple(markSlot);
91
92 /* if child rel, must check whether it produced this row */
93 if (erm->rti != erm->prti)
94 {

Callers

nothing calls this directly

Calls 13

ExecProcNodeFunction · 0.85
EvalPlanQualEndFunction · 0.85
EvalPlanQualSlotFunction · 0.85
ExecClearTupleFunction · 0.85
ExecGetJunkAttributeFunction · 0.85
DatumGetObjectIdFunction · 0.85
GetFdwRoutineForRelationFunction · 0.85
table_tuple_lockFunction · 0.85
EvalPlanQualBeginFunction · 0.85
EvalPlanQualNextFunction · 0.85
foreachFunction · 0.50
errcodeFunction · 0.50

Tested by

no test coverage detected