Go through the cache code for non-local queries as a no-op

At least, break the hard dependency for local shards
remote_prepared_txes
Onder Kalaci 2022-11-16 09:50:02 +01:00
parent bafd0c00f6
commit ecd0af1e72
1 changed files with 28 additions and 28 deletions

View File

@ -67,13 +67,18 @@ CacheFastPathPlanForShardQuery(Task *task, DistributedPlan *originalDistributedP
* functions/params to have been evaluated in the cached plan.
*/
Query *jobQuery = copyObject(originalDistributedPlan->workerJob->jobQuery);
PlannedStmt *localPlan = NULL;
Query *localShardQuery = GetLocalShardQueryForCache(jobQuery, task, paramListInfo);
if (TaskAccessesLocalNode(task))
{
Query *localShardQuery =
GetLocalShardQueryForCache(jobQuery, task, paramListInfo);
LOCKMODE lockMode = GetQueryLockMode(localShardQuery);
/* fast path queries can only have a single RTE by definition */
RangeTblEntry *rangeTableEntry = (RangeTblEntry *) linitial(localShardQuery->rtable);
RangeTblEntry *rangeTableEntry =
(RangeTblEntry *) linitial(localShardQuery->rtable);
/*
* If the shard has been created in this transction, we wouldn't see the relationId
@ -89,8 +94,12 @@ CacheFastPathPlanForShardQuery(Task *task, DistributedPlan *originalDistributedP
LockRelationOid(rangeTableEntry->relid, lockMode);
localPlan = planner(localShardQuery, NULL, 0, NULL);
}
else
{ }
FastPathPlanCache *fastPathPlanCache = CitusMakeNode(FastPathPlanCache);
PlannedStmt *localPlan = planner(localShardQuery, NULL, 0, NULL);
fastPathPlanCache->localPlan = localPlan;
fastPathPlanCache->shardId = task->anchorShardId;
fastPathPlanCache->placementGroupIds = TaskGroupIdAccesses(task);
@ -318,15 +327,6 @@ IsFastPathPlanCachingSupported(Job *currentJob, DistributedPlan *originalDistrib
return false;
}
if (!TaskAccessesLocalNode(linitial(taskList)))
{
/*
* TODO: we'll remove this, but for the tests not to
* break, keep on this temp commit.
*/
return false;
}
Query *originalJobQuery = originalDistributedPlan->workerJob->jobQuery;
if (contain_volatile_functions((Node *) originalJobQuery))
{