Repository: incubator-hawq
Updated Branches:
  refs/heads/master 733c94747 -> 15c148b35


HAWQ-578. Avoid validating whether total allocated resource is more than 
maximum YARN resource queue capacity


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

Branch: refs/heads/master
Commit: 15c148b355f20dec2a47c9c54de8df3b5076c872
Parents: 733c947
Author: YI JIN <[email protected]>
Authored: Wed Mar 23 14:00:53 2016 +1100
Committer: YI JIN <[email protected]>
Committed: Wed Mar 23 14:00:53 2016 +1100

----------------------------------------------------------------------
 src/backend/resourcemanager/include/errorcode.h |  1 +
 src/backend/resourcemanager/resourcepool.c      | 25 ++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/15c148b3/src/backend/resourcemanager/include/errorcode.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/errorcode.h 
b/src/backend/resourcemanager/include/errorcode.h
index de08fff..0a2eb09 100644
--- a/src/backend/resourcemanager/include/errorcode.h
+++ b/src/backend/resourcemanager/include/errorcode.h
@@ -137,6 +137,7 @@ enum DRM_ERROR_CODE {
        RESOURCEPOOL_DUPLICATE_HOST,
        RESOURCEPOOL_UNRESOLVED_HOST,
        RESOURCEPOOL_TOO_MANY_UAVAILABLE_HOST,
+       RESOURCEPOOL_TOO_MANY_CONTAINERS,
 
        
/*-----------------------------------------------------------------------*/
        COMM2RM_CLIENT_START_TAG = 500,

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/15c148b3/src/backend/resourcemanager/resourcepool.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcepool.c 
b/src/backend/resourcemanager/resourcepool.c
index 3a8d72b..3359207 100644
--- a/src/backend/resourcemanager/resourcepool.c
+++ b/src/backend/resourcemanager/resourcepool.c
@@ -1972,6 +1972,21 @@ int  addGRMContainerToToBeAccepted(GRMContainer ctn)
        /* The host must has registered resource information linked. */
        Assert( ctn->Resource != NULL);
 
+       /* If the new container makes total possible resource quota greater than
+        * maximum resource capacity, reject this container.
+        */
+       uint32_t memlimit = DRMGlobalInstance->ImpType == NONE_HAWQ2 ?
+                                               
ctn->Resource->Stat->FTSTotalMemoryMB :
+                                               
ctn->Resource->Stat->GRMTotalMemoryMB;
+       if ( ctn->Resource->IncPending.MemoryMB + 
ctn->Resource->Allocated.MemoryMB > memlimit )
+       {
+               elog(WARNING, "Global resource manager allocated too many 
containers to "
+                                         "host %s. To return this host's 
resource container at once.",
+                                         ctn->HostName);
+               addGRMContainerToKicked(ctn);
+               return RESOURCEPOOL_TOO_MANY_CONTAINERS;
+       }
+
        /* Set the resource as increasing pending. */
        addResourceBundleData(&(ctn->Resource->IncPending), ctn->MemoryMB, 
ctn->Core);
 
@@ -4162,10 +4177,12 @@ void validateResourcePoolStatus(bool refquemgr)
 
        if ( totalallocmem > mem || totalalloccore > core )
        {
-               elog(ERROR, "HAWQ RM Validation. Allocated too much resource in 
resource "
-                                       "pool. (%d MB, %lf CORE)",
-                                       totalallocmem,
-                                       totalalloccore);
+               elog(WARNING, "HAWQ RM Validation. Allocated too much resource 
in resource "
+                                         "pool (%d MB, %lf CORE), maximum 
capacity (%d MB, %lf CORE)",
+                                         totalallocmem,
+                                         totalalloccore,
+                                         core,
+                                         mem);
        }
 
        /*

Reply via email to