From: Pavan Deolasee Date: Tue, 21 Aug 2018 09:54:13 +0000 (+0530) Subject: Ensure that RemoteSubplan is marked parallel unsafe. X-Git-Tag: XL_10_R1BETA1~28 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=27c1751cbfdd06046cf38b37952d14691bc1295d;p=postgres-xl.git Ensure that RemoteSubplan is marked parallel unsafe. We can't support multiple backends running RemoteSubplan in parallel. So block that. In fact, we'd already done so by setting parallel_safe to false while creating the path, but there is another code path which builds the plan node directly and we'd missed that. --- diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index e561448570..cae36be417 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -5890,6 +5890,9 @@ make_remotesubplan(PlannerInfo *root, plan->righttree = NULL; copy_plan_costsize(plan, lefttree); + /* RemoteSubplan is not parallel_safe */ + plan->parallel_safe = false; + node->cursor = get_internal_cursor(); node->unique = 0; return node; diff --git a/src/test/regress/expected/select_parallel.out b/src/test/regress/expected/select_parallel.out index 82069afc0f..e32bc9b8f1 100644 --- a/src/test/regress/expected/select_parallel.out +++ b/src/test/regress/expected/select_parallel.out @@ -134,20 +134,17 @@ alter table tenk2 set (parallel_workers = 0); explain (costs off) select count(*) from tenk1 where (two, four) not in (select hundred, thousand from tenk2 where thousand > 100); - QUERY PLAN -------------------------------------------------------------------------------------- - Finalize Aggregate + QUERY PLAN +------------------------------------------------------------------------- + Aggregate -> Remote Subquery Scan on all (datanode_1,datanode_2) - -> Gather - Workers Planned: 4 - -> Partial Aggregate - -> Parallel Seq Scan on tenk1 - Filter: (NOT (hashed SubPlan 1)) - SubPlan 1 - -> Remote Subquery Scan on all (datanode_1,datanode_2) - -> Seq Scan on tenk2 - Filter: (thousand > 100) -(11 rows) + -> Seq Scan on tenk1 + Filter: (NOT (hashed SubPlan 1)) + SubPlan 1 + -> Remote Subquery Scan on all (datanode_1,datanode_2) + -> Seq Scan on tenk2 + Filter: (thousand > 100) +(8 rows) select count(*) from tenk1 where (two, four) not in (select hundred, thousand from tenk2 where thousand > 100);