Merge pull request #2444 from citusdata/memory_fix_attempt

Attempt to address planner context crashes
pull/2446/head
Metin Döşlü 2018-10-19 10:15:55 +03:00 committed by GitHub
commit 3a97988ada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -157,6 +157,10 @@ distributed_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
result = CreateDistributedPlannedStmt(planId, result, originalQuery, parse, result = CreateDistributedPlannedStmt(planId, result, originalQuery, parse,
boundParams, plannerRestrictionContext); boundParams, plannerRestrictionContext);
setPartitionedTablesInherited = true;
AdjustPartitioningForDistributedPlanning(parse,
setPartitionedTablesInherited);
} }
} }
PG_CATCH(); PG_CATCH();
@ -166,13 +170,6 @@ distributed_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
} }
PG_END_TRY(); PG_END_TRY();
if (needsDistributedPlanning)
{
setPartitionedTablesInherited = true;
AdjustPartitioningForDistributedPlanning(parse, setPartitionedTablesInherited);
}
/* remove the context from the context list */ /* remove the context from the context list */
PopPlannerRestrictionContext(); PopPlannerRestrictionContext();
@ -1517,6 +1514,13 @@ CurrentPlannerRestrictionContext(void)
plannerRestrictionContext = plannerRestrictionContext =
(PlannerRestrictionContext *) linitial(plannerRestrictionContextList); (PlannerRestrictionContext *) linitial(plannerRestrictionContextList);
if (plannerRestrictionContext == NULL)
{
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("planner restriction context stack was empty"),
errdetail("Please report this to the Citus core team.")));
}
return plannerRestrictionContext; return plannerRestrictionContext;
} }