From: Pavan Deolasee Date: Thu, 23 Aug 2018 05:24:37 +0000 (+0530) Subject: Ensure parallelModeNeeded flag is sent down to the remote node. X-Git-Tag: XL_10_R1BETA1~25 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=37318034e6568dda6f6212662154345d89ec9f3f;p=postgres-xl.git Ensure parallelModeNeeded flag is sent down to the remote node. This still does not solve the problem that the datanodes don't make use of parallel queries during distributed execution (they work OK if queries are FQSed). That's because PostgreSQL does not support parallel queries when a portal is used to fetch only a part of the result set. We need separate patches to either fix or work-around that. --- diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index f61905d84a..40ee9eea27 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -1571,6 +1571,7 @@ _outRemoteStmt(StringInfo str, const RemoteStmt *node) WRITE_ENUM_FIELD(commandType, CmdType); WRITE_BOOL_FIELD(hasReturning); + WRITE_BOOL_FIELD(parallelModeNeeded); WRITE_NODE_FIELD(planTree); WRITE_NODE_FIELD(rtable); WRITE_NODE_FIELD(resultRelations); diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index ff752fc1c0..5eaf6b36c4 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -3649,6 +3649,7 @@ _readRemoteStmt(void) READ_ENUM_FIELD(commandType, CmdType); READ_BOOL_FIELD(hasReturning); + READ_BOOL_FIELD(parallelModeNeeded); READ_NODE_FIELD(planTree); READ_NODE_FIELD(rtable); READ_NODE_FIELD(resultRelations); diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index c8bc3276fa..b05943a304 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -5479,6 +5479,7 @@ ExecInitRemoteSubplan(RemoteSubplan *node, EState *estate, int eflags) */ RemoteSubplanMakeUnique((Node *) outerPlan(node), PGXCNodeId); } + rstmt.parallelModeNeeded = estate->es_plannedstmt->parallelModeNeeded; rstmt.planTree = outerPlan(node); /* * If datanode launch further execution of a command it should tell diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c index 501cd54b9b..9b9bd47f9c 100644 --- a/src/backend/utils/cache/plancache.c +++ b/src/backend/utils/cache/plancache.c @@ -2062,6 +2062,7 @@ SetRemoteSubplan(CachedPlanSource *plansource, const char *plan_string) stmt->distributionKey = rstmt->distributionKey; stmt->distributionNodes = rstmt->distributionNodes; stmt->distributionRestrict = rstmt->distributionRestrict; + stmt->parallelModeNeeded = rstmt->parallelModeNeeded; /* * Set up SharedQueue if intermediate results need to be distributed diff --git a/src/include/pgxc/execRemote.h b/src/include/pgxc/execRemote.h index b7c0f5b7a1..bf73d4c3e7 100644 --- a/src/include/pgxc/execRemote.h +++ b/src/include/pgxc/execRemote.h @@ -198,6 +198,8 @@ typedef struct RemoteStmt bool hasReturning; /* is it insert|update|delete RETURNING? */ + bool parallelModeNeeded; + struct Plan *planTree; /* tree of Plan nodes */ List *rtable; /* list of RangeTblEntry nodes */