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-650. Redundent idle qe for copy table to file.
Date Sun, 10 Apr 2016 03:11:22 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 75710a256 -> 22c6095fd


HAWQ-650. Redundent idle qe for copy table to file.


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

Branch: refs/heads/master
Commit: 22c6095fdadad446e26981e37034443fc6477529
Parents: 75710a2
Author: hzhang2 <zhanghuan929@163.com>
Authored: Sun Apr 10 11:07:19 2016 +0800
Committer: hzhang2 <zhanghuan929@163.com>
Committed: Sun Apr 10 11:07:19 2016 +0800

----------------------------------------------------------------------
 src/backend/commands/copy.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/22c6095f/src/backend/commands/copy.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 6dc41c1..9910ec3 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -1777,7 +1777,7 @@ static int calculate_virtual_segment_number(List* candidateOids) {
 	int64 totalDataSize = 0;
 	bool isHashRelationExist = false;
 	int maxHashBucketNumber = 0;
-
+	int maxSegno = 0;
 	foreach (le1, candidateOids)
 	{
 		Oid				candidateOid	  = InvalidOid;
@@ -1803,6 +1803,28 @@ static int calculate_virtual_segment_number(List* candidateOids) {
 			if (!isHashRelationExist) {
 				totalDataSize += calculate_relation_size(rel);
 			}
+
+      // calculate file segno.
+      if(RelationIsAoRows(rel))
+      {
+        FileSegTotals *fstotal = GetSegFilesTotals(rel, SnapshotNow);
+        if(fstotal){
+          if(maxSegno < fstotal->totalfilesegs){
+            maxSegno = fstotal->totalfilesegs;
+          }
+          pfree(fstotal);
+        }
+      }
+      else if(RelationIsParquet(rel))
+      {
+        ParquetFileSegTotals *fstotal = GetParquetSegFilesTotals(rel, SnapshotNow);
+        if(fstotal){
+          if (maxSegno < fstotal->totalfilesegs) {
+            maxSegno = fstotal->totalfilesegs;
+          }
+          pfree(fstotal);
+        }
+      }
 		}
 		relation_close(rel, AccessShareLock);
 	}
@@ -1819,6 +1841,10 @@ static int calculate_virtual_segment_number(List* candidateOids) {
 	if(vsegNumber > GetQueryVsegNum()){
 		vsegNumber = GetQueryVsegNum();
 	}
+	// if vsegnum bigger than maxsegno, which will lead to idle QE
+	if(vsegNumber > maxSegno && maxSegno > 0){
+	  vsegNumber = maxSegno;
+	}
 
 	return vsegNumber;
 }


Mime
View raw message