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-382. Adjust combined workload index in resource pool in different situations
Date Tue, 02 Feb 2016 23:22:24 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master f08b5e6c6 -> 454d66803


HAWQ-382. Adjust combined workload index in resource pool in different situations


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

Branch: refs/heads/master
Commit: 454d668037d18f1a7aa9c13ddb36e0dd802bf00a
Parents: f08b5e6
Author: YI JIN <yjin@pivotal.io>
Authored: Wed Feb 3 10:15:39 2016 +1100
Committer: YI JIN <yjin@pivotal.io>
Committed: Wed Feb 3 10:15:39 2016 +1100

----------------------------------------------------------------------
 .../resourcemanager/include/resourcepool.h      |  1 -
 src/backend/resourcemanager/resourcepool.c      | 43 +++++++-------------
 2 files changed, 14 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/454d6680/src/backend/resourcemanager/include/resourcepool.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/resourcepool.h b/src/backend/resourcemanager/include/resourcepool.h
index b7b25a1..01c97aa 100644
--- a/src/backend/resourcemanager/include/resourcepool.h
+++ b/src/backend/resourcemanager/include/resourcepool.h
@@ -546,7 +546,6 @@ SegResource getSegResource(int32_t id);
 int  addGRMContainerToToBeAccepted(GRMContainer ctn);
 void GRMContainerToAccepted(GRMContainer ctn);
 void addGRMContainerToResPool(GRMContainer ctn);
-void dropGRMContainerFromResPool(GRMContainer ctn);
 
 void addGRMContainerToToBeKicked(GRMContainer ctn);
 void addGRMContainerToKicked(GRMContainer ctn);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/454d6680/src/backend/resourcemanager/resourcepool.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcepool.c b/src/backend/resourcemanager/resourcepool.c
index 8d39e67..cb43342 100644
--- a/src/backend/resourcemanager/resourcepool.c
+++ b/src/backend/resourcemanager/resourcepool.c
@@ -1494,6 +1494,7 @@ int setSegResHAWQAvailability( SegResource segres, uint8_t newstatus)
 		reorderSegResourceAvailIndex(segres, ratio);
 		reorderSegResourceAllocIndex(segres, ratio);
 	}
+	reorderSegResourceCombinedWorkloadIndex(segres);
 
 	elog(LOG, "Host %s is set availability %d. Cluster currently has %d available nodes.",
 			  GET_SEGRESOURCE_HOSTNAME(segres),
@@ -1771,6 +1772,7 @@ void addGRMContainerToResPool(GRMContainer container)
 
 	reorderSegResourceAvailIndex(segresource, ratio);
 	reorderSegResourceAllocIndex(segresource, ratio);
+	reorderSegResourceCombinedWorkloadIndex(segresource);
 
 	elog(LOG, "Resource manager added resource container into resource pool "
 			  "(%d MB, %d CORE) at %s (%d:%.*s)",
@@ -1782,35 +1784,6 @@ void addGRMContainerToResPool(GRMContainer container)
 			  GET_SEGRESOURCE_HOSTNAME(segresource));
 }
 
-void dropGRMContainerFromResPool(GRMContainer ctn)
-{
-	minusResourceBundleData(&(ctn->Resource->Allocated), ctn->MemoryMB, ctn->Core);
-	minusResourceBundleData(&(ctn->Resource->Available), ctn->MemoryMB, ctn->Core);
-
-	Assert( ctn->Resource->Allocated.MemoryMB >= 0 );
-	Assert( ctn->Resource->Allocated.Core >= 0     );
-	Assert( ctn->Resource->Available.MemoryMB >= 0 );
-	Assert( ctn->Resource->Available.Core >= 0     );
-
-	Assert( ctn->Resource->Allocated.MemoryMB >= 0 );
-	Assert( ctn->Resource->Allocated.Core >= 0     );
-	Assert( ctn->Resource->Available.MemoryMB >= 0 );
-	Assert( ctn->Resource->Available.Core >= 0     );
-
-	uint32_t ratio = trunc(ctn->MemoryMB / ctn->Core);
-	reorderSegResourceAllocIndex(ctn->Resource, ratio);
-	reorderSegResourceAvailIndex(ctn->Resource, ratio);
-
-	elog(LOG, "Resource manager dropped resource container from resource pool "
-			  "(%d MB, %d CORE) at %s (%d:%.*s)",
-			  ctn->MemoryMB,
-			  ctn->Core,
-			  ctn->HostName,
-			  ctn->Resource->Stat->ID,
-			  ctn->Resource->Stat->Info.HostNameLen,
-			  GET_SEGRESOURCE_HOSTNAME(ctn->Resource));
-}
-
 void addGRMContainerToToBeKicked(GRMContainer ctn)
 {
 	uint32_t				hostnamelen		= 0;
@@ -2991,6 +2964,7 @@ void returnAllGRMResourceFromSegment(SegResource segres)
 		reorderSegResourceAllocIndex(segres, PQUEMGR->RatioReverseIndex[i]);
 		reorderSegResourceAvailIndex(segres, PQUEMGR->RatioReverseIndex[i]);
 	}
+	reorderSegResourceCombinedWorkloadIndex(segres);
 
 	Assert(segres->Allocated.MemoryMB == 0);
 	Assert(segres->Allocated.Core == 0.0);
@@ -3078,6 +3052,7 @@ void dropAllGRMContainersFromSegment(SegResource segres)
 		reorderSegResourceAllocIndex(segres, PQUEMGR->RatioReverseIndex[i]);
 		reorderSegResourceAvailIndex(segres, PQUEMGR->RatioReverseIndex[i]);
 	}
+	reorderSegResourceCombinedWorkloadIndex(segres);
 
 	elog(LOG, "Resource manager cleared %u containers, old in-use resource "
 				  "is set (%d MB, %lf CORE)",
@@ -3443,6 +3418,7 @@ void timeoutIdleGRMResourceToRBByRatio(int 		 ratioindex,
 
 			reorderSegResourceAllocIndex(resource, ratio);
 			reorderSegResourceAvailIndex(resource, ratio);
+			reorderSegResourceCombinedWorkloadIndex(resource);
 
 			addGRMContainerToToBeKicked(retcont);
 			(*realretcontnum)++;
@@ -3548,6 +3524,7 @@ bool setSegResRUAlivePending( SegResource segres, bool pending)
 		reorderSegResourceAllocIndex(segres, ratio);
 		reorderSegResourceAvailIndex(segres, ratio);
 	}
+	reorderSegResourceCombinedWorkloadIndex(segres);
 	return res;
 }
 
@@ -3605,6 +3582,7 @@ void checkGRMContainerStatus(RB_GRMContainerStat ctnstats, int size)
 	{
 		SegResource segres = getSegResource(i);
 		Assert(segres != NULL);
+		bool segreschanged = false;
 
 		for( int ridx = 0 ; ridx < PQUEMGR->RatioCount ; ++ridx )
 		{
@@ -3671,6 +3649,9 @@ void checkGRMContainerStatus(RB_GRMContainerStat ctnstats, int size)
 								  "it is not treated active in YARN");
 
 					minusResourceFromReourceManager(ctn->MemoryMB, ctn->Core);
+
+					segreschanged = true;
+
 					validateResourcePoolStatus(true);
 				}
 				else
@@ -3688,6 +3669,10 @@ void checkGRMContainerStatus(RB_GRMContainerStat ctnstats, int size)
 				}
 			}
 		}
+		if ( segreschanged )
+		{
+			reorderSegResourceCombinedWorkloadIndex(segres);
+		}
 	}
 	MEMORY_CONTEXT_SWITCH_BACK
 


Mime
View raw message