hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hubertzh...@apache.org
Subject incubator-hawq git commit: HAWQ-652. Slicemap in dispatch is mismatched when run multiple query in one session.
Date Sun, 10 Apr 2016 03:26:57 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 22c6095fd -> 4538dcd82


HAWQ-652. Slicemap in dispatch is mismatched when run multiple query in one session.


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

Branch: refs/heads/master
Commit: 4538dcd82731bd11c5b28ac52ad906b86bcbfb54
Parents: 22c6095
Author: hzhang2 <zhanghuan929@163.com>
Authored: Sun Apr 10 11:24:58 2016 +0800
Committer: hzhang2 <zhanghuan929@163.com>
Committed: Sun Apr 10 11:24:58 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbdispatchresult.c | 18 ++++++-------
 src/backend/cdb/dispatcher.c        |  2 ++
 src/backend/cdb/dispatcher_mgt.c    | 44 +-------------------------------
 src/include/cdb/dispatcher_mgt.h    | 16 +++++++++++-
 4 files changed, 27 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4538dcd8/src/backend/cdb/cdbdispatchresult.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbdispatchresult.c b/src/backend/cdb/cdbdispatchresult.c
index d97dda5..c70c43f 100644
--- a/src/backend/cdb/cdbdispatchresult.c
+++ b/src/backend/cdb/cdbdispatchresult.c
@@ -150,10 +150,9 @@ cdbdisp_makeResult(struct CdbDispatchResults           *meleeResults,
         }
         else
         {
-            if (si->resultBegin > meleeIndex)
-                si->resultBegin = meleeIndex;
-            if (si->resultEnd <= meleeIndex)
-                si->resultEnd = meleeIndex + 1;
+            Assert(si->resultBegin <= meleeIndex);
+            Assert(si->resultEnd <= meleeIndex);
+            si->resultEnd = meleeIndex + 1;
         }
     }
 
@@ -685,10 +684,11 @@ cdbdisp_makeDispatchResults(int     resultCapacity,
                             int     sliceCapacity,
                             bool    cancelOnError)
 {
-    CdbDispatchResults *results = palloc0(sizeof(*results));
-    int     nbytes = resultCapacity * sizeof(results->resultArray[0]);
+    CdbDispatchResults *results = (CdbDispatchResults*) palloc0(sizeof(CdbDispatchResults));
+    int     nbytes = resultCapacity * sizeof(CdbDispatchResult);
+
+    results->resultArray = (CdbDispatchResult*) palloc0(nbytes);
 
-    results->resultArray = palloc0(nbytes);
     results->resultCapacity = resultCapacity;
     results->resultCount = 0;
     results->iFirstError = -1;
@@ -699,8 +699,8 @@ cdbdisp_makeDispatchResults(int     resultCapacity,
     results->sliceCapacity = sliceCapacity;
     if (sliceCapacity > 0)
     {
-        nbytes = sliceCapacity * sizeof(results->sliceMap[0]);
-        results->sliceMap = palloc0(nbytes);
+        nbytes = sliceCapacity * sizeof(CdbDispatchResults_SliceInfo);
+        results->sliceMap = (CdbDispatchResults_SliceInfo*) palloc0(nbytes);
     }
 
     return results;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4538dcd8/src/backend/cdb/dispatcher.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/dispatcher.c b/src/backend/cdb/dispatcher.c
index 67530fd..349c077 100644
--- a/src/backend/cdb/dispatcher.c
+++ b/src/backend/cdb/dispatcher.c
@@ -963,6 +963,8 @@ dispatcher_bind_executor(DispatchData *data)
 			    concurrent_connect_executors = lappend(concurrent_connect_executors,
                                                  info);
 			    data->num_of_new_connected_executors++;
+			    if (!executormgr_bind_executor_task(data, executor, info->desc, task, slice))
+			      return false;
 			  }
 			  continue;
 			}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4538dcd8/src/backend/cdb/dispatcher_mgt.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/dispatcher_mgt.c b/src/backend/cdb/dispatcher_mgt.c
index 7cf2573..1f7a155 100644
--- a/src/backend/cdb/dispatcher_mgt.c
+++ b/src/backend/cdb/dispatcher_mgt.c
@@ -62,28 +62,11 @@ typedef struct QueryExecutorGroupIterator
 	int		group_id;
 } QueryExecutorGroupIterator;
 
-/*
- * ConcurrentConnectExecutorInfo
- *	Used to create the executor concurrently.
- */
-typedef struct ConcurrentConnectExecutorInfo {
-	bool					is_writer;
-	bool					is_superuser;
-	struct QueryExecutor	*executor;
-	struct DispatchData		*data;
-	struct DispatchSlice	*slice;
-	struct DispatchTask		*task;
-
-	struct SegmentDatabaseDescriptor *desc;
-} ConcurrentConnectExecutorInfo;
-
-
 /* Iterate all of groups. */
 static void	dispmgt_init_query_executor_group_iterator(QueryExecutorTeam *team,
 							QueryExecutorGroupIterator *iterator);
 static QueryExecutorGroup *dispmgt_get_query_executor_group_iterator(
 							QueryExecutorGroupIterator *iterator);
-static bool dispmgt_bind_executor_task(List *executors);
 
 
 
@@ -554,7 +537,7 @@ dispmgt_concurrent_connect(List	*executors, int executors_num_per_thread)
 	dispmgt_free_concurrent_connect_state(tasks);
 	workermgr_free_workermgr_state(state);
 
-	return dispmgt_bind_executor_task(executors);
+	return true;
 }
 
 ConcurrentConnectExecutorInfo *
@@ -584,29 +567,4 @@ dispmgt_free_preconnect_info(ConcurrentConnectExecutorInfo *info)
 	pfree(info);
 }
 
-/*
- * dispmgt_bind_executor_task
- */
-static bool
-dispmgt_bind_executor_task(List *executors)
-{
-	ListCell	*lc;
-	bool		has_error = false;
-
-	foreach(lc, executors)
-	{
-		ConcurrentConnectExecutorInfo	*info = lfirst(lc);
-
-		if (has_error)
-		{
-			executormgr_free_executor(info->desc);
-			continue;
-		}
-
-		if (!executormgr_bind_executor_task(info->data, info->executor, info->desc, info->task,
info->slice))
-			has_error = true;
-	}
-
-	return !has_error;
-}
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4538dcd8/src/include/cdb/dispatcher_mgt.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/dispatcher_mgt.h b/src/include/cdb/dispatcher_mgt.h
index e386a47..5e2b9a9 100644
--- a/src/include/cdb/dispatcher_mgt.h
+++ b/src/include/cdb/dispatcher_mgt.h
@@ -27,7 +27,6 @@ struct DispatchData;
 struct QueryExecutorTeam;
 struct QueryExecutor;
 struct WorkerMgrState;
-struct ConcurrentConnectExecutorInfo;
 struct Segment;
 struct DispatchSlice;
 struct DispatchTask;
@@ -41,6 +40,21 @@ typedef struct QueryExecutorIterator
 } QueryExecutorIterator;
 
 /*
+ * ConcurrentConnectExecutorInfo
+ *  Used to create the executor concurrently.
+ */
+typedef struct ConcurrentConnectExecutorInfo {
+  bool          is_writer;
+  bool          is_superuser;
+  struct QueryExecutor  *executor;
+  struct DispatchData   *data;
+  struct DispatchSlice  *slice;
+  struct DispatchTask   *task;
+
+  struct SegmentDatabaseDescriptor *desc;
+} ConcurrentConnectExecutorInfo;
+
+/*
  * QueryExecutorTeam/QueryExecutorGroup
  */
 typedef struct QueryExecutorGroup {


Mime
View raw message