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-162. YARN containers are required evenly
Date Sat, 14 Nov 2015 11:25:41 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 8ff1a07e0 -> 3a36f0fa9


HAWQ-162. YARN containers are required evenly


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

Branch: refs/heads/master
Commit: 3a36f0fa938c78b5d03107919e9d3415a656154d
Parents: 8ff1a07
Author: Yi Jin <yjin@pivotal.io>
Authored: Sat Nov 14 19:25:23 2015 +0800
Committer: Yi Jin <yjin@pivotal.io>
Committed: Sat Nov 14 19:25:23 2015 +0800

----------------------------------------------------------------------
 src/backend/resourcemanager/resourcemanager.c | 37 +++++++++++++++-------
 1 file changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/3a36f0fa/src/backend/resourcemanager/resourcemanager.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcemanager.c b/src/backend/resourcemanager/resourcemanager.c
index 815ba92..b112749 100644
--- a/src/backend/resourcemanager/resourcemanager.c
+++ b/src/backend/resourcemanager/resourcemanager.c
@@ -2281,16 +2281,16 @@ void completeAllocRequestToBroker(int32_t 	 *reqmem,
 
 		allunavail = false;
 
-		int clevel = segres->ContainerSets[0] == NULL ?
-					 0 :
-					 list_length(segres->ContainerSets[0]->Containers) +
+		int clevel = (segres->ContainerSets[0] == NULL ?
+					  0 :
+					  list_length(segres->ContainerSets[0]->Containers)) +
 					 segres->IncPending.MemoryMB / ratio;
 
 		ListCell *pcell = NULL;
 		foreach(pcell, *preferred)
 		{
 			PAIR existpair = (PAIR)lfirst(pcell);
-			if ( pair->Value == segres )
+			if ( existpair->Key == segres )
 			{
 				reqidx[index] = existpair;
 				totalcount += ((ResourceBundle)(reqidx[index]->Value))->MemoryMB /
@@ -2299,12 +2299,11 @@ void completeAllocRequestToBroker(int32_t 	 *reqmem,
 			}
 		}
 
-
 		int creqsize = reqidx[index] == NULL ?
 					   0 :
 					   ((ResourceBundle)(reqidx[index]->Value))->MemoryMB / ratio;
 
-		llevel = clevel+creqsize < llevel ? clevel+creqsize : llevel;
+		llevel = (clevel+creqsize) < llevel ? (clevel+creqsize) : llevel;
 		index++;
 	}
 
@@ -2315,6 +2314,23 @@ void completeAllocRequestToBroker(int32_t 	 *reqmem,
 		return;
 	}
 
+	for ( int i = 0 ; i < list_length(ressegl) ; ++i )
+	{
+		if ( reqidx[i] == NULL )
+		{
+			continue;
+		}
+
+		elog(RMLOG, "Expect resource from resource broker with "
+				    "preferred host, hostname:%s, container number:%lf, "
+				    "increase pending %d.",
+				    GET_SEGRESOURCE_HOSTNAME(((SegResource)(reqidx[i]->Key))),
+					((ResourceBundle)(reqidx[i]->Value))->Core,
+					((SegResource)(reqidx[i]->Key))->IncPending.MemoryMB/ratio);
+	}
+
+	elog(RMLOG, "Lowest water level before adjusting is %d.", llevel);
+
 	/* Step 2. Adjust request. */
 	int32_t reqcoreleft = *reqcore - totalcount;
 	bool keeplooping = true;
@@ -2346,15 +2362,14 @@ void completeAllocRequestToBroker(int32_t 	 *reqmem,
 			/* Check total capacity of the segment. */
 			uint32_t corecap = getSegResourceCapacityCore(segres);
 
-
-			int clevel = segres->ContainerSets[0] == NULL ?
-						 0 :
-						 list_length(segres->ContainerSets[0]->Containers) +
+			int clevel = (segres->ContainerSets[0] == NULL ?
+						  0 :
+						  list_length(segres->ContainerSets[0]->Containers)) +
 						 segres->IncPending.MemoryMB / ratio;
 
 			int aclevel = reqidx[index] == NULL ?
 						  clevel :
-						  clevel + ((ResourceBundle)(reqidx[index]->Value))->MemoryMB / ratio;
+						  (clevel + ((ResourceBundle)(reqidx[index]->Value))->MemoryMB / ratio);
 
 			if ( llevel > aclevel && llevel <= corecap )
 			{


Mime
View raw message