hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From y...@apache.org
Subject incubator-hawq git commit: HAWQ-152. Pass validation test in resource manager for unexactly divisible memory core ratio
Date Thu, 12 Nov 2015 06:05:05 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 7be514893 -> 0b0bad4dd


HAWQ-152. Pass validation test in resource manager for unexactly divisible memory core ratio


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

Branch: refs/heads/master
Commit: 0b0bad4ddaf3b8ea89e18144b5b1e1588b698c4c
Parents: 7be5148
Author: Yi Jin <yjin@pivotal.io>
Authored: Thu Nov 12 14:04:41 2015 +0800
Committer: Yi Jin <yjin@pivotal.io>
Committed: Thu Nov 12 14:04:41 2015 +0800

----------------------------------------------------------------------
 src/backend/resourcemanager/include/resourcepool.h | 4 ++++
 src/backend/resourcemanager/resourcepool.c         | 7 +++++--
 src/backend/resourcemanager/resqueuemanager.c      | 6 ++++--
 3 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0b0bad4d/src/backend/resourcemanager/include/resourcepool.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/resourcepool.h b/src/backend/resourcemanager/include/resourcepool.h
index 7e93773..494e3e7 100644
--- a/src/backend/resourcemanager/include/resourcepool.h
+++ b/src/backend/resourcemanager/include/resourcepool.h
@@ -651,6 +651,10 @@ void add_segment_config_row(int32_t 	 id,
 
 #define SEGMENT_STATUS_UP   	'u'
 #define SEGMENT_STATUS_DOWN 	'd'
+
+#define VALIDATE_RATIO_BIAS 	0.005
+#define VALIDATE_RESOURCE_BIAS	0.0001
+
 void validateResourcePoolStatus(bool refquemgr);
 
 /*

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0b0bad4d/src/backend/resourcemanager/resourcepool.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcepool.c b/src/backend/resourcemanager/resourcepool.c
index 47ba2ee..3c6bfee 100644
--- a/src/backend/resourcemanager/resourcepool.c
+++ b/src/backend/resourcemanager/resourcepool.c
@@ -3342,12 +3342,14 @@ void validateResourcePoolStatus(bool refquemgr)
 			}
 
 			/* Validation 2. The ratio should be correct. */
+			double r1 = alloccore == 0 ? 0 : allocmem/alloccore;
+			double r2 = availcore == 0 ? 0 : availmem/availcore;
 			if ( (allocmem == 0 && alloccore != 0) ||
 				 (allocmem != 0 && alloccore == 0) ||
 				 (availmem == 0 && availcore != 0) ||
 				 (availmem != 0 && availcore == 0) ||
 				 (alloccore != 0 && availcore != 0 &&
-				  trunc(allocmem/alloccore) != trunc(availmem/availcore)))
+				  2 * fabs(r1-r2) / (r1 + r2) > VALIDATE_RATIO_BIAS) )
 			{
 				elog(ERROR, "HAWQ RM Validation. Wrong resource counter ratio. "
 							"Host %s. "
@@ -3433,7 +3435,8 @@ void validateResourcePoolStatus(bool refquemgr)
 						PQUEMGR->RatioTrackers[0]->TotalAllocated.Core);
 		}
 
-		if ( totalavailmem > totalallocmem || totalavailcore > totalalloccore )
+		if ( totalavailmem > totalallocmem ||
+			 totalavailcore > totalalloccore * (1+VALIDATE_RESOURCE_BIAS) )
 		{
 				elog(ERROR, "HAWQ RM Validation. Wrong total allocated resource. "
 							"In resource pool available (%d MB, %lf CORE), "

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0b0bad4d/src/backend/resourcemanager/resqueuemanager.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resqueuemanager.c b/src/backend/resourcemanager/resqueuemanager.c
index fc51a9a..c2da496 100644
--- a/src/backend/resourcemanager/resqueuemanager.c
+++ b/src/backend/resourcemanager/resqueuemanager.c
@@ -3085,8 +3085,10 @@ void dispatchResourceToQueries(void)
 						 track->TotalAllocated.Core,
 						 track->QueueInfo->Name);
 
-			Assert( track->TotalAllocated.MemoryMB >= track->TotalUsed.MemoryMB &&
-					track->TotalAllocated.Core     >= track->TotalUsed.Core) ;
+			double evalcore = track->TotalAllocated.Core == 0 ?
+							  VALIDATE_RESOURCE_BIAS :
+							  track->TotalAllocated.Core * (1+VALIDATE_RESOURCE_BIAS);
+			Assert(evalcore >= track->TotalUsed.Core);
 		DQUEUE_LOOP_END
 
 		/*


Mime
View raw message