mirror of https://github.com/citusdata/citus.git
suggestions to improve debug messages
parent
b84cc4b825
commit
7534345984
|
|
@ -428,9 +428,10 @@ UpdateWhereClauseToPushdownRecurringOuterJoin(Query *query, List *relationShardL
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ereport(DEBUG5, (errmsg(
|
ereport(DEBUG1, (errmsg("injecting quals for the distributed rel \"%s\" to "
|
||||||
"Distributed table from the inner part of the outer join: %s.",
|
"pushdown the outer join because the outer rel is a "
|
||||||
innerRte->eref->aliasname)));
|
"recurring rel",
|
||||||
|
GetRelationNameAndAliasName(innerRte))));
|
||||||
|
|
||||||
RelationShard *relationShard = FindRelationShard(innerRte->relid,
|
RelationShard *relationShard = FindRelationShard(innerRte->relid,
|
||||||
relationShardList);
|
relationShardList);
|
||||||
|
|
|
||||||
|
|
@ -786,8 +786,10 @@ RecursivelyPlanRecurringTupleOuterJoinWalker(Node *node, Query *query,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ereport(DEBUG3, (errmsg(
|
ereport(DEBUG1, (errmsg("can pushdown the left join with "
|
||||||
"a push down safe left join with recurring left side")));
|
"the recurring relation on the left "
|
||||||
|
"side and distributed relation on "
|
||||||
|
"the right side")));
|
||||||
leftNodeRecurs = false; /* left node will be pushed down */
|
leftNodeRecurs = false; /* left node will be pushed down */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -819,8 +821,10 @@ RecursivelyPlanRecurringTupleOuterJoinWalker(Node *node, Query *query,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ereport(DEBUG3, (errmsg(
|
ereport(DEBUG1, (errmsg("can pushdown the right join with "
|
||||||
"a push down safe right join with recurring left side")));
|
"the recurring relation on the right "
|
||||||
|
"side and distributed relation on "
|
||||||
|
"the left side")));
|
||||||
rightNodeRecurs = false; /* right node will be pushed down */
|
rightNodeRecurs = false; /* right node will be pushed down */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2705,16 +2709,26 @@ hasPseudoconstantQuals(RelationRestrictionContext *relationRestrictionContext)
|
||||||
static bool
|
static bool
|
||||||
CanPushdownRecurringOuterJoinOnOuterRTE(RangeTblEntry *rte)
|
CanPushdownRecurringOuterJoinOnOuterRTE(RangeTblEntry *rte)
|
||||||
{
|
{
|
||||||
if (IsCitusTable(rte->relid) && IsCitusTableType(rte->relid, REFERENCE_TABLE))
|
if (rte->relid != RTE_RELATION)
|
||||||
{
|
{
|
||||||
return true;
|
ereport(DEBUG2, (errmsg("cannot pushdown the recurring outer "
|
||||||
|
"join because recurring relation \"%s\" "
|
||||||
|
"(rte kind: %d) is not a table",
|
||||||
|
GetRelationNameAndAliasName(rte), rte->rtekind)));
|
||||||
|
}
|
||||||
|
else if (!IsCitusTableType(rte->relid, REFERENCE_TABLE))
|
||||||
|
{
|
||||||
|
ereport(DEBUG2, (errmsg("cannot pushdown the recurring outer "
|
||||||
|
"join because recurring relation \"%s\" "
|
||||||
|
"is not a reference table",
|
||||||
|
GetRelationNameAndAliasName(rte))));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ereport(DEBUG5, (errmsg("RTE type %d is not safe for pushdown",
|
return true;
|
||||||
rte->rtekind)));
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2764,22 +2778,23 @@ ResolveBaseVarFromSubquery(Var *var, Query *query,
|
||||||
* it is the partition column and hash distributed, otherwise it returns false.
|
* it is the partition column and hash distributed, otherwise it returns false.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
CanPushdownRecurringOuterJoinOnInnerVar(Var *innerVar, RangeTblEntry *rte)
|
CanPushdownRecurringOuterJoinOnInnerVar(Var *innerVar, RangeTblEntry *citusTableRte)
|
||||||
{
|
{
|
||||||
if (!innerVar || !rte)
|
if (!innerVar || innerVar->varattno == InvalidAttrNumber)
|
||||||
{
|
{
|
||||||
|
ereport(DEBUG3, (errmsg("cannot pushdown the recurring outer join on this qual "
|
||||||
|
"because inner variable is NULL or doesn't reference to "
|
||||||
|
"a valid attribute number")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (innerVar->varattno == InvalidAttrNumber)
|
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(citusTableRte->relid);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CitusTableCacheEntry *cacheEntry = GetCitusTableCacheEntry(rte->relid);
|
|
||||||
|
|
||||||
if (!cacheEntry || GetCitusTableType(cacheEntry) != HASH_DISTRIBUTED)
|
if (!cacheEntry || GetCitusTableType(cacheEntry) != HASH_DISTRIBUTED)
|
||||||
{
|
{
|
||||||
|
ereport(DEBUG3, (errmsg("cannot pushdown the recurring outer join on this qual "
|
||||||
|
"because inner variable is not part of a hash distributed "
|
||||||
|
"table")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2790,6 +2805,9 @@ CanPushdownRecurringOuterJoinOnInnerVar(Var *innerVar, RangeTblEntry *rte)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ereport(DEBUG3, (errmsg("cannot pushdown the recurring outer join on this qual "
|
||||||
|
"because inner variable is not part of the distribution "
|
||||||
|
"column of the hash distributed table")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2873,9 +2891,15 @@ CanPushdownRecurringOuterJoinExtended(JoinExpr *joinExpr, Query *query,
|
||||||
{
|
{
|
||||||
if (!EnableRecurringOuterJoinPushdown)
|
if (!EnableRecurringOuterJoinPushdown)
|
||||||
{
|
{
|
||||||
|
ereport(DEBUG1, (errmsg("cannot pushdown the recurring outer joins "
|
||||||
|
"because citus.enable_recurring_outer_join_pushdown "
|
||||||
|
"was disabled")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: ideally should not have this check once we implement the changes to not call */
|
||||||
|
/* CanPushdownRecurringOuterJoinExtended in deparse_shard_query.c */
|
||||||
|
/* when we don't have an outer join between a recurring and a distributed rel */
|
||||||
if (!IS_OUTER_JOIN(joinExpr->jointype))
|
if (!IS_OUTER_JOIN(joinExpr->jointype))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2883,22 +2907,25 @@ CanPushdownRecurringOuterJoinExtended(JoinExpr *joinExpr, Query *query,
|
||||||
|
|
||||||
if (joinExpr->jointype != JOIN_LEFT && joinExpr->jointype != JOIN_RIGHT)
|
if (joinExpr->jointype != JOIN_LEFT && joinExpr->jointype != JOIN_RIGHT)
|
||||||
{
|
{
|
||||||
return false;
|
ereport(DEBUG2, (errmsg("cannot pushdown the recurring outer "
|
||||||
|
"join because join is not a left or "
|
||||||
|
"right outer join")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Push down for chained joins is not supported in this path. */
|
/* Push down for chained joins is not supported in this path. */
|
||||||
if (IsA(joinExpr->rarg, JoinExpr) || IsA(joinExpr->larg, JoinExpr))
|
if (IsA(joinExpr->rarg, JoinExpr) || IsA(joinExpr->larg, JoinExpr))
|
||||||
{
|
{
|
||||||
ereport(DEBUG5, (errmsg(
|
ereport(DEBUG2, (errmsg("cannot pushdown the recurring outer "
|
||||||
"One side is a join expression, pushdown is not supported in this path.")));
|
"join because chained joins are not "
|
||||||
|
"supported yet")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Push down for joins with fromExpr on one side is not supported in this path. */
|
/* Push down for joins with fromExpr on one side is not supported in this path. */
|
||||||
if (!IsA(joinExpr->larg, RangeTblRef) || !IsA(joinExpr->rarg, RangeTblRef))
|
if (!IsA(joinExpr->larg, RangeTblRef) || !IsA(joinExpr->rarg, RangeTblRef))
|
||||||
{
|
{
|
||||||
ereport(DEBUG5, (errmsg(
|
ereport(DEBUG2, (errmsg("cannot pushdown the recurring outer "
|
||||||
"One side is not a RangeTblRef, pushdown is not supported in this path.")));
|
"join because one side is a FromExpr")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2922,11 +2949,12 @@ CanPushdownRecurringOuterJoinExtended(JoinExpr *joinExpr, Query *query,
|
||||||
* This check can be improved to support the cases where the lateral reference
|
* This check can be improved to support the cases where the lateral reference
|
||||||
* does not cause an error in the final planner checks.
|
* does not cause an error in the final planner checks.
|
||||||
*/
|
*/
|
||||||
if (JoinTreeContainsLateral(joinExpr->rarg, query->rtable) || JoinTreeContainsLateral(
|
if (JoinTreeContainsLateral(joinExpr->rarg, query->rtable) ||
|
||||||
joinExpr->larg, query->rtable))
|
JoinTreeContainsLateral(joinExpr->larg, query->rtable))
|
||||||
{
|
{
|
||||||
ereport(DEBUG5, (errmsg(
|
ereport(DEBUG2, (errmsg("cannot pushdown the recurring outer "
|
||||||
"Lateral join is not supported for pushdown in this path.")));
|
"join because lateral joins are not "
|
||||||
|
"supported yet")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2934,6 +2962,8 @@ CanPushdownRecurringOuterJoinExtended(JoinExpr *joinExpr, Query *query,
|
||||||
List *joinClauseList = make_ands_implicit((Expr *) joinExpr->quals);
|
List *joinClauseList = make_ands_implicit((Expr *) joinExpr->quals);
|
||||||
if (joinClauseList == NIL)
|
if (joinClauseList == NIL)
|
||||||
{
|
{
|
||||||
|
ereport(DEBUG2, (errmsg("cannot pushdown the recurring outer "
|
||||||
|
"join because join has no clauses")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3007,6 +3037,11 @@ CanPushdownRecurringOuterJoinExtended(JoinExpr *joinExpr, Query *query,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ereport(DEBUG2, (errmsg(
|
||||||
|
"cannot pushdown the recurring outer join because no eligible "
|
||||||
|
"join quals were found to inject quals for recurring rel to "
|
||||||
|
"match distribution column of the distributed table on shards")));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue