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-210. Improve data locality by calculating the insert host.
Date Thu, 03 Dec 2015 11:21:54 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master bbd7e0ae3 -> 7080c0636


HAWQ-210. Improve data locality by calculating the insert host.


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

Branch: refs/heads/master
Commit: 7080c0636b7ca0d409272c47749f4775ba39c700
Parents: bbd7e0a
Author: hubertzhang <hzhang@pivotal.io>
Authored: Thu Dec 3 19:12:12 2015 +0800
Committer: hubertzhang <hzhang@pivotal.io>
Committed: Thu Dec 3 19:12:12 2015 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbdatalocality.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7080c063/src/backend/cdb/cdbdatalocality.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbdatalocality.c b/src/backend/cdb/cdbdatalocality.c
index 6c45b9f..e860b69 100644
--- a/src/backend/cdb/cdbdatalocality.c
+++ b/src/backend/cdb/cdbdatalocality.c
@@ -2672,7 +2672,7 @@ static void allocate_random_relation(Relation_Data* rel_data,
 							hostOccurTimes[key]++;
 						}
 			}
-			int maxOccurTime=-1;
+			int maxOccurTime = -1;
 			int inserthost = -1;
 			for(int i=0;i< context->dds_context.size;i++){
 				if(hostOccurTimes[i] > maxOccurTime){
@@ -2680,10 +2680,16 @@ static void allocate_random_relation(Relation_Data* rel_data,
 				  inserthost = i;
 				}
 			}
-			/*we consider the insert hosts are the same for blocks in the same file. This logic can
be changed in future*/
-			for (i = 0; i < rel_file->split_num; i++) {
-				Block_Host_Index *hostID = rel_file->hostIDs + i;
-				hostID->insertHost = inserthost;
+
+			/* currently we consider the insert hosts are the same for all the blocks in the same
file.
+			 * this logic can be changed in future, so we store the state in block level not file
level*/
+			if(maxOccurTime < rel_file->split_num){
+				inserthost = -1;
+			}else{
+				for (i = 0; i < rel_file->split_num; i++) {
+					Block_Host_Index *hostID = rel_file->hostIDs + i;
+					hostID->insertHost = inserthost;
+				}
 			}
 	}
 	pfree(hostOccurTimes);


Mime
View raw message