diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-10-06 15:12:51 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-10-06 15:12:51 -0400 |
commit | f2343653f5b2aecfc759f36dbb3fd2a61f36853e (patch) | |
tree | 3e1fcb103bd838a0b3715b6e11a9e44d3f358f10 /src/backend/executor/execUtils.c | |
parent | 0209f0285d9b1c60bf74cc9f5f0133d7bdd887c3 (diff) | |
download | postgresql-f2343653f5b2aecfc759f36dbb3fd2a61f36853e.tar.gz postgresql-f2343653f5b2aecfc759f36dbb3fd2a61f36853e.zip |
Remove more redundant relation locking during executor startup.
We already have appropriate locks on every relation listed in the
query's rangetable before we reach the executor. Take the next step
in exploiting that knowledge by removing code that worries about
taking locks on non-leaf result relations in a partitioned table.
In particular, get rid of ExecLockNonLeafAppendTables and a stanza in
InitPlan that asserts we already have locks on certain such tables.
In passing, clean up some now-obsolete comments in InitPlan.
Amit Langote, reviewed by David Rowley and Jesper Pedersen,
and whacked around a bit more by me
Discussion: https://postgr.es/m/468c85d9-540e-66a2-1dde-fec2b741e688@lab.ntt.co.jp
Diffstat (limited to 'src/backend/executor/execUtils.c')
-rw-r--r-- | src/backend/executor/execUtils.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index b75062f74c4..650fd81ff17 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -900,66 +900,6 @@ ShutdownExprContext(ExprContext *econtext, bool isCommit) } /* - * ExecLockNonLeafAppendTables - * - * Locks, if necessary, the tables indicated by the RT indexes contained in - * the partitioned_rels list. These are the non-leaf tables in the partition - * tree controlled by a given Append or MergeAppend node. - */ -void -ExecLockNonLeafAppendTables(List *partitioned_rels, EState *estate) -{ - PlannedStmt *stmt = estate->es_plannedstmt; - ListCell *lc; - - foreach(lc, partitioned_rels) - { - ListCell *l; - Index rti = lfirst_int(lc); - bool is_result_rel = false; - Oid relid = exec_rt_fetch(rti, estate)->relid; - - /* If this is a result relation, already locked in InitPlan */ - foreach(l, stmt->nonleafResultRelations) - { - if (rti == lfirst_int(l)) - { - is_result_rel = true; - break; - } - } - - /* - * Not a result relation; check if there is a RowMark that requires - * taking a RowShareLock on this rel. - */ - if (!is_result_rel) - { - PlanRowMark *rc = NULL; - LOCKMODE lockmode; - - foreach(l, stmt->rowMarks) - { - if (((PlanRowMark *) lfirst(l))->rti == rti) - { - rc = lfirst(l); - break; - } - } - - if (rc && RowMarkRequiresRowShareLock(rc->markType)) - lockmode = RowShareLock; - else - lockmode = AccessShareLock; - - Assert(lockmode == exec_rt_fetch(rti, estate)->rellockmode); - - LockRelationOid(relid, lockmode); - } - } -} - -/* * GetAttributeByName * GetAttributeByNum * |