Return early in CreateDistributedPlan for fast path router

fix/fastPathPlanner
Sait Talha Nisanci 2020-12-05 13:15:56 +03:00
parent 164d73ad8c
commit ae2251c03f
1 changed files with 24 additions and 1 deletions

View File

@ -75,6 +75,7 @@ static uint64 NextPlanId = 1;
int PlannerLevel = 0;
static bool ListContainsDistributedTableRTE(List *rangeTableList);
static bool IsFastPathRouterQuery(PlannerRestrictionContext *plannerRestrictionContext);
static bool IsUpdateOrDelete(Query *query);
static PlannedStmt * CreateDistributedPlannedStmt(
DistributedPlanningContext *planContext);
@ -125,7 +126,6 @@ static PlannedStmt * PlanDistributedStmt(DistributedPlanningContext *planContext
int rteIdCounter);
static RTEListProperties * GetRTEListProperties(List *rangeTableList);
/* Distributed planner hook */
PlannedStmt *
distributed_planner(Query *parse,
@ -959,6 +959,13 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
return NULL;
}
if (distributedPlan->planningError && IsFastPathRouterQuery(
plannerRestrictionContext))
{
/* we don't need to continue with fast path router query */
RaiseDeferredErrorInternal(distributedPlan->planningError, ERROR);
}
/* force evaluation of bound params */
boundParams = copyParamList(boundParams);
@ -1075,6 +1082,22 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
}
/*
* IsFastPathRouterQuery returns true if we are processing a fast path router query.
*/
static bool
IsFastPathRouterQuery(PlannerRestrictionContext *plannerRestrictionContext)
{
if (plannerRestrictionContext &&
plannerRestrictionContext->fastPathRestrictionContext &&
plannerRestrictionContext->fastPathRestrictionContext->fastPathRouterQuery)
{
return true;
}
return false;
}
/*
* EnsurePartitionTableNotReplicated errors out if the infput relation is
* a partition table and the table has a replication factor greater than