1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Set consider_parallel correctly for upper planner rels.

Commit 3fc6e2d7f5 introduced new "upper"
RelOptInfo structures but didn't set consider_parallel for them
correctly, a point I completely missed when reviewing it.  Later,
commit e06a38965b made the situation
worse by doing it incorrectly for the grouping relation.  Try to
straighten all of that out.  Along the way, get rid of the annoying
wholePlanParallelSafe flag, which was only necessarily because of
the fact that upper planning stages didn't use paths at the time
that code was written.

The most important immediate impact of these changes is that
force_parallel_mode will provide useful test coverage in quite a few
more scenarios than it did previously, but it's also necessary
preparation for fixing some problems related to subqueries.

Patch by me, reviewed by Tom Lane.
This commit is contained in:
Robert Haas
2016-07-01 11:43:19 -04:00
parent 0daeba0e92
commit 5ce5e4a12e
7 changed files with 132 additions and 106 deletions

View File

@ -2177,7 +2177,8 @@ create_projection_path(PlannerInfo *root,
pathnode->path.param_info = NULL;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
subpath->parallel_safe &&
!has_parallel_hazard((Node *) target->exprs, false);
pathnode->path.parallel_workers = subpath->parallel_workers;
/* Projection does not change the sort order */
pathnode->path.pathkeys = subpath->pathkeys;
@ -2304,6 +2305,16 @@ apply_projection_to_path(PlannerInfo *root,
gpath->subpath,
target);
}
else if (path->parallel_safe &&
has_parallel_hazard((Node *) target->exprs, false))
{
/*
* We're inserting a parallel-restricted target list into a path
* currently marked parallel-safe, so we have to mark it as no longer
* safe.
*/
path->parallel_safe = false;
}
return path;
}