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-287. Control whether to pass data locality prefer list to resource manager.
Date Tue, 29 Dec 2015 03:29:46 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 4835ec284 -> 2e604a223


HAWQ-287. Control whether to pass data locality prefer list to resource manager.


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

Branch: refs/heads/master
Commit: 2e604a223c4726b2a59a00feca145c1984ec03bc
Parents: 4835ec2
Author: hubertzhang <hzhang@pivotal.io>
Authored: Tue Dec 29 11:26:15 2015 +0800
Committer: hubertzhang <hzhang@pivotal.io>
Committed: Tue Dec 29 11:26:15 2015 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbdatalocality.c | 29 +++++++++++++++++------------
 src/backend/cdb/cdbvars.c         |  1 +
 src/backend/utils/misc/guc.c      | 10 ++++++++++
 src/include/cdb/cdbvars.h         |  2 ++
 4 files changed, 30 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2e604a22/src/backend/cdb/cdbdatalocality.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbdatalocality.c b/src/backend/cdb/cdbdatalocality.c
index 3ab90b3..5951ba7 100644
--- a/src/backend/cdb/cdbdatalocality.c
+++ b/src/backend/cdb/cdbdatalocality.c
@@ -3991,19 +3991,24 @@ calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
 		/*generate hostname-volumn pair to help RM to choose a host with
 		 *maximum data locality(only when the vseg number less than host number)
 		 */
-		context.host_context.size = context.dds_context.size;
-		MemoryContextSwitchTo(context.datalocality_memorycontext);
-		context.host_context.hostnameVolInfos = (HostnameVolumnInfo *) palloc(
-				sizeof(HostnameVolumnInfo) * context.host_context.size);
-		for (int i = 0; i < context.host_context.size; i++) {
-			MemSet(&(context.host_context.hostnameVolInfos[i].hostname), 0,
-					HOSTNAME_MAX_LENGTH);
-			strncpy(context.host_context.hostnameVolInfos[i].hostname,
-					context.dds_context.volInfos[i].hashEntry->key.hostname,
-					HOSTNAME_MAX_LENGTH-1);
-			context.host_context.hostnameVolInfos[i].datavolumn = context.dds_context.volInfos[i].datavolumn;
+		if(enable_prefer_list_to_rm){
+			context.host_context.size = context.dds_context.size;
+			MemoryContextSwitchTo(context.datalocality_memorycontext);
+			context.host_context.hostnameVolInfos = (HostnameVolumnInfo *) palloc(
+					sizeof(HostnameVolumnInfo) * context.host_context.size);
+			for (int i = 0; i < context.host_context.size; i++) {
+				MemSet(&(context.host_context.hostnameVolInfos[i].hostname), 0,
+						HOSTNAME_MAX_LENGTH);
+				strncpy(context.host_context.hostnameVolInfos[i].hostname,
+						context.dds_context.volInfos[i].hashEntry->key.hostname,
+						HOSTNAME_MAX_LENGTH-1);
+				context.host_context.hostnameVolInfos[i].datavolumn = context.dds_context.volInfos[i].datavolumn;
+			}
+			MemoryContextSwitchTo(context.old_memorycontext);
+		}else{
+			context.host_context.size = 0;
+			context.host_context.hostnameVolInfos = NULL;
 		}
-		MemoryContextSwitchTo(context.old_memorycontext);
 
 		/* determine the random table segment number by the following 4 steps*/
 		/* Step1 we expect one split(block) processed by one virtual segment*/

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2e604a22/src/backend/cdb/cdbvars.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbvars.c b/src/backend/cdb/cdbvars.c
index c2406c6..3b3c4be 100644
--- a/src/backend/cdb/cdbvars.c
+++ b/src/backend/cdb/cdbvars.c
@@ -289,6 +289,7 @@ bool datalocality_remedy_enable;
 bool get_tmpdir_from_rm;
 bool debug_fake_segmentnum;
 bool debug_datalocality_time;
+bool enable_prefer_list_to_rm;
 
 /* New HAWQ 2.0 basic GUCs. Some of these are duplicate variables, they are
  * reserved to facilitate showing settings in hawq-site.xml. */

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2e604a22/src/backend/utils/misc/guc.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 4caeee9..a08a812 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -4155,6 +4155,16 @@ static struct config_bool ConfigureNamesBool[] =
 	},
 
 	{
+		{"enable_prefer_list_to_rm;", PGC_USERSET, DEVELOPER_OPTIONS,
+			gettext_noop("Sets whether enable data locality prefer list passed to rm"),
+			NULL,
+			GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
+		},
+		&enable_prefer_list_to_rm,
+		true, NULL, NULL
+	},
+
+	{
 		{"datalocality_remedy_enable", PGC_USERSET, DEVELOPER_OPTIONS,
 			gettext_noop("Sets whether enable data locality remedy when nonlocal read"),
 			NULL,

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/2e604a22/src/include/cdb/cdbvars.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/cdbvars.h b/src/include/cdb/cdbvars.h
index ff55d75..8456337 100644
--- a/src/include/cdb/cdbvars.h
+++ b/src/include/cdb/cdbvars.h
@@ -1222,6 +1222,8 @@ extern int min_datasize_to_combine_segment;
 extern int datalocality_algorithm_version;
 extern int min_cost_for_each_query;
 
+extern bool enable_prefer_list_to_rm;
+
 typedef enum
 {
 	HASH_TO_RANDOM_BASEDON_DATALOCALITY = 0,


Mime
View raw message