提交 ef6651d5 编写于 作者: D Daniel Gustafsson

Avoid using GP_ROLE_UNDEFINED in code

The segment role GP_ROLE_UNDEFINED should never be set, and cdbvars
is guarding against that ever happening. Thus, testing for it in the
code makes it look like it could indeed happen which is misleading
to the reader. Remove the test and refactor the switch() to instead
use an if-else clause with an assertion that maintains the same
guarantee as the previous coding did.

Discussion: https://github.com/greenplum-db/gpdb/pull/6423Reviewed-by: NAshwin Agrawal <aagrawal@pivotal.io>
上级 35b58c8a
......@@ -140,16 +140,12 @@ cdbparallelize(PlannerInfo *root,
PlanProfile *context = &profile;
/* Make sure we're called correctly (and need to be called). */
switch (Gp_role)
{
case GP_ROLE_DISPATCH:
break;
case GP_ROLE_UTILITY:
return plan;
case GP_ROLE_EXECUTE:
case GP_ROLE_UNDEFINED:
Insist(0);
}
if (Gp_role == GP_ROLE_UTILITY)
return plan;
if (Gp_role != GP_ROLE_DISPATCH)
elog(ERROR, "Plan parallelization invoked for incorrect role: %s",
role_to_string(Gp_role));
Assert(is_plan_node((Node *) plan));
Assert(query !=NULL && IsA(query, Query));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册