You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by hu...@apache.org on 2015/12/03 02:49:59 UTC

incubator-hawq git commit: HAWQ-203. Add GUC for debug metadata, datalocality, rm time.

Repository: incubator-hawq
Updated Branches:
  refs/heads/master 4b7b97915 -> 9e151e069
Updated Tags:  refs/tags/1.1.4.0-RC1 [created] c63d24e49
  refs/tags/1.2.0.1B1Beta-RC1 [created] a19af0125


HAWQ-203. Add GUC for debug metadata, datalocality, rm time.


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

Branch: refs/heads/master
Commit: 9e151e069461798c794a24fa9d514cc8a5a31356
Parents: 4b7b979
Author: hubertzhang <hz...@pivotal.io>
Authored: Thu Dec 3 09:44:37 2015 +0800
Committer: hubertzhang <hz...@pivotal.io>
Committed: Thu Dec 3 09:44:37 2015 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbdatalocality.c | 20 +++++++++++++++++++-
 src/backend/cdb/cdbvars.c         |  1 +
 src/backend/utils/misc/guc.c      | 10 ++++++++++
 src/include/cdb/cdbvars.h         |  1 +
 4 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9e151e06/src/backend/cdb/cdbdatalocality.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbdatalocality.c b/src/backend/cdb/cdbdatalocality.c
index ae21324..d74896d 100644
--- a/src/backend/cdb/cdbdatalocality.c
+++ b/src/backend/cdb/cdbdatalocality.c
@@ -893,6 +893,10 @@ int64 get_block_locations_and_claculte_table_size(split_to_segment_mapping_conte
 	" %d us with hit rate %f \n", totalFileCount,eclaspeTime,hitrate);
 	context->total_file_count = totalFileCount;
 	context->total_size = total_size;
+
+	if(debug_datalocality_time){
+		elog(LOG, "metadata overall execution time: %d us. \n", eclaspeTime);
+	}
 	return total_size;
 }
 
@@ -3800,7 +3804,12 @@ run_allocation_algorithm(SplitAllocResult *result, List *virtual_segments, Query
 
 	alloc_result = post_process_assign_result(&split_assign_result);
 
-
+	uint64_t run_datalocality = 0;
+	run_datalocality = gettime_microsec();
+	int dl_overall_time = run_datalocality - before_run_allocation;
+	if(debug_datalocality_time){
+		elog(LOG, "datalocality overall execution time: %d us. \n", dl_overall_time);
+	}
 	return alloc_result;
 }
 
@@ -4046,6 +4055,7 @@ calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
 			maxTargetSegmentNumber = enforce_virtual_segment_number;
 			minTargetSegmentNumber = enforce_virtual_segment_number;
 		}
+		uint64_t before_rm_allocate_resource = gettime_microsec();
 		if (QRL_NONE != resourceLife) {
 			resource = AllocateResource(QRL_ONCE, sliceNum, context.total_size,
 					maxTargetSegmentNumber, minTargetSegmentNumber,
@@ -4059,6 +4069,11 @@ calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
 					&seg_num_min, &seg_memory_mb, &seg_core);
 			planner_segments = seg_num;
 		}
+		uint64_t after_rm_allocate_resource = gettime_microsec();
+		int eclaspeTime = after_rm_allocate_resource - before_rm_allocate_resource;
+		if(debug_datalocality_time){
+			elog(LOG, "rm allocate resource overall execution time: %d us. \n", eclaspeTime);
+		}
 
 		if (resource == NULL) {
 			result->resource = NULL;
@@ -4104,5 +4119,8 @@ calculate_planner_segment_num(Query *query, QueryResourceLife resourceLife,
 
 	cleanup_allocation_algorithm(&context);
 
+	if(debug_datalocality_time){
+		elog(ERROR, "Abort debug metadata, datalocality, rm Time.");
+	}
 	return result;
 }

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9e151e06/src/backend/cdb/cdbvars.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbvars.c b/src/backend/cdb/cdbvars.c
index d4343c4..b5c79b8 100644
--- a/src/backend/cdb/cdbvars.c
+++ b/src/backend/cdb/cdbvars.c
@@ -305,6 +305,7 @@ bool debug_fake_datalocality;
 bool datalocality_remedy_enable;
 bool get_tmpdir_from_rm;
 bool debug_fake_segmentnum;
+bool debug_datalocality_time;
 
 /* 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/9e151e06/src/backend/utils/misc/guc.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index d28161c..1761a96 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -4199,6 +4199,16 @@ static struct config_bool ConfigureNamesBool[] =
 	},
 
 	{
+		{"debug_datalocality_time", PGC_USERSET, DEVELOPER_OPTIONS,
+			gettext_noop("Sets whether enable debug data locality to check elapse time of metadata, datalocality, rm"),
+			NULL,
+			GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE
+		},
+		&debug_datalocality_time,
+		false, 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/9e151e06/src/include/cdb/cdbvars.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/cdbvars.h b/src/include/cdb/cdbvars.h
index 397f0a9..efe6815 100644
--- a/src/include/cdb/cdbvars.h
+++ b/src/include/cdb/cdbvars.h
@@ -1163,6 +1163,7 @@ extern bool debug_fake_datalocality;
 extern bool datalocality_remedy_enable;
 extern bool get_tmpdir_from_rm;
 extern bool debug_fake_segmentnum;
+extern bool debug_datalocality_time;
 
 /* New HAWQ 2.0 basic GUCs */
 extern char   *master_addr_host;