Skip to content

Commit 9d86458

Browse files
committed
Fix parallel worker assignment for partial paths
fix #1366 Update parallel_workers assignment to handle cases where partial paths may have parallel_workers = 0 after parallel-oblivious append. Move assignment before assertion and use pathnode->parallel_workers in the check. Authored-by: Zhang Mingli avamingli@gmail.com
1 parent 4d22043 commit 9d86458

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/backend/optimizer/util/pathnode.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,12 +2156,17 @@ set_append_path_locus(PlannerInfo *root, Path *pathnode, RelOptInfo *rel,
21562156
* Partially fixed append issue.
21572157
* But there are still several locus can't be parallel so that we can't handle it currently.
21582158
*/
2159-
AssertImply(parallel_workers > 1 &&
2159+
/*
2160+
* After we try parallel-bolivious append, there could be possible that partial paths with
2161+
* parallel_workers = 0, ex: a partial path and Motion to a path with parallel_workers = 0.
2162+
*/
2163+
pathnode->parallel_workers = targetlocus.parallel_workers;
2164+
2165+
AssertImply(pathnode->parallel_workers > 1 &&
21602166
!CdbPathLocus_IsEntry(targetlocus) &&
21612167
!CdbPathLocus_IsOuterQuery(targetlocus) &&
21622168
!CdbPathLocus_IsGeneral(targetlocus) &&
21632169
!CdbPathLocus_IsSingleQE(targetlocus), targetlocus.parallel_workers > 1);
2164-
pathnode->parallel_workers = targetlocus.parallel_workers;
21652170

21662171
*subpaths_out = new_subpaths;
21672172

0 commit comments

Comments
 (0)