diff options
author | Amit Langote <amitlan@postgresql.org> | 2025-05-22 14:17:24 +0900 |
---|---|---|
committer | Amit Langote <amitlan@postgresql.org> | 2025-05-22 17:02:35 +0900 |
commit | 1722d5eb05d8e5d2e064cd1798abcae4f296ca9d (patch) | |
tree | 6661dfcd476b8e355f4f05d38badbe1c6de2ed36 /src/include/executor/executor.h | |
parent | f3622b64762bb5ee5242937f0fadcacb1a10f30e (diff) |
Revert "Don't lock partitions pruned by initial pruning"
As pointed out by Tom Lane, the patch introduced fragile and invasive
design around plan invalidation handling when locking of prunable
partitions was deferred from plancache.c to the executor. In
particular, it violated assumptions about CachedPlan immutability and
altered executor APIs in ways that are difficult to justify given the
added complexity and overhead.
This also removes the firstResultRels field added to PlannedStmt in
commit 28317de72, which was intended to support deferred locking of
certain ModifyTable result relations.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/605328.1747710381@sss.pgh.pa.us
Diffstat (limited to 'src/include/executor/executor.h')
-rw-r--r-- | src/include/executor/executor.h | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index ae99407db89..104b059544d 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -19,7 +19,6 @@ #include "nodes/lockoptions.h" #include "nodes/parsenodes.h" #include "utils/memutils.h" -#include "utils/plancache.h" /* @@ -73,7 +72,7 @@ /* Hook for plugins to get control in ExecutorStart() */ -typedef bool (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); +typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; /* Hook for plugins to get control in ExecutorRun() */ @@ -229,11 +228,8 @@ ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull) /* * prototypes from functions in execMain.c */ -extern bool ExecutorStart(QueryDesc *queryDesc, int eflags); -extern void ExecutorStartCachedPlan(QueryDesc *queryDesc, int eflags, - CachedPlanSource *plansource, - int query_index); -extern bool standard_ExecutorStart(QueryDesc *queryDesc, int eflags); +extern void ExecutorStart(QueryDesc *queryDesc, int eflags); +extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags); extern void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count); extern void standard_ExecutorRun(QueryDesc *queryDesc, @@ -300,30 +296,6 @@ extern void ExecEndNode(PlanState *node); extern void ExecShutdownNode(PlanState *node); extern void ExecSetTupleBound(int64 tuples_needed, PlanState *child_node); -/* - * Is the CachedPlan in es_cachedplan still valid? - * - * Called from InitPlan() because invalidation messages that affect the plan - * might be received after locks have been taken on runtime-prunable relations. - * The caller should take appropriate action if the plan has become invalid. - */ -static inline bool -ExecPlanStillValid(EState *estate) -{ - return estate->es_cachedplan == NULL ? true : - CachedPlanValid(estate->es_cachedplan); -} - -/* - * Locks are needed only if running a cached plan that might contain unlocked - * relations, such as a reused generic plan. - */ -static inline bool -ExecShouldLockRelations(EState *estate) -{ - return estate->es_cachedplan == NULL ? false : - CachedPlanRequiresLocking(estate->es_cachedplan); -} /* ---------------------------------------------------------------- * ExecProcNode |