hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cjcjame...@apache.org
Subject [72/80] [abbrv] incubator-hawq git commit: HAWQ-800. Fix less tuple is inserted due to data locality information is not refreshed and dispatched in prepared statement
Date Wed, 29 Jun 2016 01:21:30 GMT
HAWQ-800. Fix less tuple is inserted due to data locality information is not refreshed and
dispatched in prepared statement


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/b74baf5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/b74baf5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/b74baf5c

Branch: refs/heads/HAWQ-537
Commit: b74baf5cb1294f5b8ce411ab43f04afb3b9faac4
Parents: a6622b8
Author: Ruilong Huo <rhuo@pivotal.io>
Authored: Mon Jun 27 10:48:28 2016 +0800
Committer: Ruilong Huo <rhuo@pivotal.io>
Committed: Mon Jun 27 11:01:47 2016 +0800

----------------------------------------------------------------------
 src/backend/executor/spi.c | 42 ++++++++++-------------------------------
 1 file changed, 10 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b74baf5c/src/backend/executor/spi.c
----------------------------------------------------------------------
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index d0029fc..c7b7f92 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -47,6 +47,7 @@
 #include "executor/nodeFunctionscan.h"
 #include "nodes/stack.h"
 #include "cdb/cdbdatalocality.h"
+#include "optimizer/planner.h"
 
 extern char *savedSeqServerHost;
 extern int savedSeqServerPort;
@@ -1146,19 +1147,11 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
 	qtlist = copyObject(qtlist);
 	ptlist = copyObject(ptlist);
 
-	PlannedStmt* stmt = (PlannedStmt*)linitial(ptlist);
+	Query *queryTree = (Query *) linitial(qtlist);
+	queryTree = copyObject(queryTree);
 
-	if ( (Gp_role == GP_ROLE_DISPATCH) &&
-			 (stmt->resource_parameters != NULL) )
-	{
-		/*
-		 * Now, we want to allocate resource.
-		 */
-		stmt->resource = AllocateResource(stmt->resource_parameters->life, stmt->resource_parameters->slice_size,
-				stmt->resource_parameters->iobytes, stmt->resource_parameters->max_target_segment_num,
-				stmt->resource_parameters->min_target_segment_num, stmt->resource_parameters->vol_info,
-				stmt->resource_parameters->vol_info_size);
-	}
+	PlannedStmt* stmt = (PlannedStmt*)linitial(ptlist);
+	stmt = refineCachedPlan(stmt, queryTree, 0 ,NULL);
 
 	/* If the plan has parameters, set them up */
 	if (spiplan->nargs > 0)
@@ -1854,30 +1847,15 @@ _SPI_execute_plan(_SPI_plan * plan, Datum *Values, const char *Nulls,
 				 * Get copy of the queryTree and the plan since this may be modified further down.
 				 */
 				queryTree = copyObject(queryTree);
-				PlannedStmt *stmt = copyObject(originalStmt);
 
-				/*
-				 * We only allocate resource for multiple executions of queries, NOT for utility commands.
-				 * SELECT/INSERT are supported at present.
-				 */
-				if((queryTree->commandType == CMD_SELECT) ||
-						(queryTree->commandType == CMD_INSERT))
+				if ((queryTree->commandType == CMD_SELECT) ||
+				    (queryTree->commandType == CMD_INSERT))
 				{
-					if ((Gp_role == GP_ROLE_DISPATCH) &&
-							(stmt->resource == NULL) &&
-							(stmt->resource_parameters != NULL))
-					{
-						stmt->resource = AllocateResource(stmt->resource_parameters->life,
-								stmt->resource_parameters->slice_size,
-								stmt->resource_parameters->iobytes,
-								stmt->resource_parameters->max_target_segment_num,
-								stmt->resource_parameters->min_target_segment_num,
-								stmt->resource_parameters->vol_info,
-								stmt->resource_parameters->vol_info_size);
-					}
-					originalStmt->resource = NULL;
+					originalStmt = refineCachedPlan(originalStmt, queryTree, 0 ,NULL);
 				}
 
+				PlannedStmt *stmt = copyObject(originalStmt);
+
 				_SPI_current->processed = 0;
 				_SPI_current->lastoid = InvalidOid;
 				_SPI_current->tuptable = NULL;


Mime
View raw message