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: Revert "HAWQ-652. Slicemap in dispatch is mismatched when run multiple query in one session."
Date Mon, 11 Apr 2016 05:41:46 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 3953930d9 -> 421b97350


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

This reverts commit 4538dcd82731bd11c5b28ac52ad906b86bcbfb54.


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

Branch: refs/heads/master
Commit: 421b97350ee64b70e7a8da6018e81ef5b471033f
Parents: 3953930
Author: hzhang2 <zhanghuan929@163.com>
Authored: Mon Apr 11 11:38:48 2016 +0800
Committer: hzhang2 <zhanghuan929@163.com>
Committed: Mon Apr 11 11:38:48 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, 53 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/421b9735/src/backend/cdb/dispatcher.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/dispatcher.c b/src/backend/cdb/dispatcher.c
index 349c077..67530fd 100644
--- a/src/backend/cdb/dispatcher.c
+++ b/src/backend/cdb/dispatcher.c
@@ -963,8 +963,6 @@ 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/421b9735/src/backend/cdb/dispatcher_mgt.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/dispatcher_mgt.c b/src/backend/cdb/dispatcher_mgt.c
index 1f7a155..7cf2573 100644
--- a/src/backend/cdb/dispatcher_mgt.c
+++ b/src/backend/cdb/dispatcher_mgt.c
@@ -62,11 +62,28 @@ 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);
 
 
 
@@ -537,7 +554,7 @@ dispmgt_concurrent_connect(List	*executors, int executors_num_per_thread)
 	dispmgt_free_concurrent_connect_state(tasks);
 	workermgr_free_workermgr_state(state);
 
-	return true;
+	return dispmgt_bind_executor_task(executors);
 }
 
 ConcurrentConnectExecutorInfo *
@@ -567,4 +584,29 @@ 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/421b9735/src/include/cdb/dispatcher_mgt.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/dispatcher_mgt.h b/src/include/cdb/dispatcher_mgt.h
index 5e2b9a9..e386a47 100644
--- a/src/include/cdb/dispatcher_mgt.h
+++ b/src/include/cdb/dispatcher_mgt.h
@@ -27,6 +27,7 @@ struct DispatchData;
 struct QueryExecutorTeam;
 struct QueryExecutor;
 struct WorkerMgrState;
+struct ConcurrentConnectExecutorInfo;
 struct Segment;
 struct DispatchSlice;
 struct DispatchTask;
@@ -40,21 +41,6 @@ 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