mirror of https://github.com/citusdata/citus.git
Go through the cache code for non-local queries as a no-op
At least, break the hard dependency for local shardsremote_prepared_txes
parent
bafd0c00f6
commit
ecd0af1e72
|
@ -67,30 +67,39 @@ CacheFastPathPlanForShardQuery(Task *task, DistributedPlan *originalDistributedP
|
||||||
* functions/params to have been evaluated in the cached plan.
|
* functions/params to have been evaluated in the cached plan.
|
||||||
*/
|
*/
|
||||||
Query *jobQuery = copyObject(originalDistributedPlan->workerJob->jobQuery);
|
Query *jobQuery = copyObject(originalDistributedPlan->workerJob->jobQuery);
|
||||||
|
PlannedStmt *localPlan = NULL;
|
||||||
|
|
||||||
Query *localShardQuery = GetLocalShardQueryForCache(jobQuery, task, paramListInfo);
|
if (TaskAccessesLocalNode(task))
|
||||||
|
|
||||||
LOCKMODE lockMode = GetQueryLockMode(localShardQuery);
|
|
||||||
|
|
||||||
/* fast path queries can only have a single RTE by definition */
|
|
||||||
RangeTblEntry *rangeTableEntry = (RangeTblEntry *) linitial(localShardQuery->rtable);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the shard has been created in this transction, we wouldn't see the relationId
|
|
||||||
* for it, so do not cache.
|
|
||||||
*/
|
|
||||||
if (rangeTableEntry->relid == InvalidOid)
|
|
||||||
{
|
{
|
||||||
pfree(jobQuery);
|
Query *localShardQuery =
|
||||||
pfree(localShardQuery);
|
GetLocalShardQueryForCache(jobQuery, task, paramListInfo);
|
||||||
MemoryContextSwitchTo(oldContext);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LockRelationOid(rangeTableEntry->relid, lockMode);
|
LOCKMODE lockMode = GetQueryLockMode(localShardQuery);
|
||||||
|
|
||||||
|
/* fast path queries can only have a single RTE by definition */
|
||||||
|
RangeTblEntry *rangeTableEntry =
|
||||||
|
(RangeTblEntry *) linitial(localShardQuery->rtable);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the shard has been created in this transction, we wouldn't see the relationId
|
||||||
|
* for it, so do not cache.
|
||||||
|
*/
|
||||||
|
if (rangeTableEntry->relid == InvalidOid)
|
||||||
|
{
|
||||||
|
pfree(jobQuery);
|
||||||
|
pfree(localShardQuery);
|
||||||
|
MemoryContextSwitchTo(oldContext);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LockRelationOid(rangeTableEntry->relid, lockMode);
|
||||||
|
|
||||||
|
localPlan = planner(localShardQuery, NULL, 0, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ }
|
||||||
|
|
||||||
FastPathPlanCache *fastPathPlanCache = CitusMakeNode(FastPathPlanCache);
|
FastPathPlanCache *fastPathPlanCache = CitusMakeNode(FastPathPlanCache);
|
||||||
PlannedStmt *localPlan = planner(localShardQuery, NULL, 0, NULL);
|
|
||||||
fastPathPlanCache->localPlan = localPlan;
|
fastPathPlanCache->localPlan = localPlan;
|
||||||
fastPathPlanCache->shardId = task->anchorShardId;
|
fastPathPlanCache->shardId = task->anchorShardId;
|
||||||
fastPathPlanCache->placementGroupIds = TaskGroupIdAccesses(task);
|
fastPathPlanCache->placementGroupIds = TaskGroupIdAccesses(task);
|
||||||
|
@ -318,15 +327,6 @@ IsFastPathPlanCachingSupported(Job *currentJob, DistributedPlan *originalDistrib
|
||||||
return false;
|
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;
|
Query *originalJobQuery = originalDistributedPlan->workerJob->jobQuery;
|
||||||
if (contain_volatile_functions((Node *) originalJobQuery))
|
if (contain_volatile_functions((Node *) originalJobQuery))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue