hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [27/39] hadoop git commit: YARN-4844. Add getMemorySize/getVirtualCoresSize to o.a.h.y.api.records.Resource. Contributed by Wangda Tan.
Date Wed, 01 Jun 2016 19:55:28 GMT
YARN-4844. Add getMemorySize/getVirtualCoresSize to o.a.h.y.api.records.Resource. Contributed by Wangda Tan.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/42f90ab8
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/42f90ab8
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/42f90ab8

Branch: refs/heads/HDFS-1312
Commit: 42f90ab885d9693fcc1e52f9637f7de4111110ae
Parents: f5ff05c
Author: Varun Vasudev <vvasudev@apache.org>
Authored: Sun May 29 20:51:02 2016 +0530
Committer: Varun Vasudev <vvasudev@apache.org>
Committed: Sun May 29 21:24:16 2016 +0530

----------------------------------------------------------------------
 .../jobhistory/JobHistoryEventHandler.java      |   4 +-
 .../v2/app/job/impl/TaskAttemptImpl.java        |   2 +-
 .../v2/app/rm/RMContainerAllocator.java         |  16 +-
 .../v2/app/rm/ResourceCalculatorUtils.java      |  17 +-
 .../CheckpointAMPreemptionPolicy.java           |   8 +-
 .../v2/app/TestCheckpointPreemptionPolicy.java  |  16 +-
 .../hadoop/mapreduce/v2/app/TestRecovery.java   |   2 +-
 .../v2/app/job/impl/TestTaskAttempt.java        |  29 +-
 .../app/local/TestLocalContainerAllocator.java  |   2 +-
 .../v2/app/rm/TestRMContainerAllocator.java     |   2 +-
 .../v2/app/rm/TestResourceCalculatorUtils.java  |   4 +-
 .../apache/hadoop/mapreduce/TypeConverter.java  |   6 +-
 .../org/apache/hadoop/mapreduce/JobStatus.java  |  18 +-
 .../jobhistory/NormalizedResourceEvent.java     |   6 +-
 .../org/apache/hadoop/mapreduce/tools/CLI.java  |   6 +-
 .../apache/hadoop/mapred/JobClientUnitTest.java |   6 +-
 .../sls/scheduler/FairSchedulerMetrics.java     |  60 +--
 .../sls/scheduler/ResourceSchedulerWrapper.java |  36 +-
 .../sls/scheduler/SLSCapacityScheduler.java     |  36 +-
 .../hadoop/yarn/api/records/Resource.java       |  34 +-
 .../src/main/proto/yarn_protos.proto            |   4 +-
 .../distributedshell/ApplicationMaster.java     |   6 +-
 .../applications/distributedshell/Client.java   |   4 +-
 .../yarn/client/api/impl/AMRMClientImpl.java    |  16 +-
 .../apache/hadoop/yarn/client/cli/NodeCLI.java  |   4 +-
 .../apache/hadoop/yarn/client/cli/TopCLI.java   |   4 +-
 .../yarn/client/api/impl/TestYarnClient.java    |   2 +-
 .../api/records/impl/pb/ResourcePBImpl.java     |  30 +-
 .../resource/DefaultResourceCalculator.java     |  36 +-
 .../resource/DominantResourceCalculator.java    |  46 +-
 .../yarn/util/resource/ResourceCalculator.java  |  10 +-
 .../hadoop/yarn/util/resource/Resources.java    |  62 ++-
 .../yarn/util/resource/TestResources.java       |   8 +-
 .../hadoop/yarn/server/utils/BuilderUtils.java  |   2 +-
 .../hadoop/yarn/server/webapp/dao/AppInfo.java  |  10 +-
 .../yarn/server/webapp/dao/ContainerInfo.java   |  10 +-
 .../hadoop/yarn/TestYarnServerApiClasses.java   |   6 +-
 .../server/nodemanager/ContainerExecutor.java   |   2 +-
 .../container/ContainerImpl.java                |   4 +-
 .../CGroupsMemoryResourceHandlerImpl.java       |   4 +-
 .../monitor/ContainersMonitorImpl.java          |   4 +-
 .../queuing/QueuingContainerManagerImpl.java    |   2 +-
 .../nodemanager/metrics/NodeManagerMetrics.java |  12 +-
 .../nodemanager/webapp/dao/ContainerInfo.java   |   2 +-
 .../nodemanager/TestNodeStatusUpdater.java      |   4 +-
 .../monitor/TestContainersMonitor.java          |   2 +-
 .../yarn/server/resourcemanager/RMNMInfo.java   |   4 +-
 .../server/resourcemanager/RMServerUtils.java   |  14 +-
 .../resourcemanager/ResourceTrackerService.java |   2 +-
 .../metrics/SystemMetricsPublisher.java         |   2 +-
 .../monitor/capacity/TempQueuePerPartition.java |  12 +-
 .../AbstractSchedulerPlanFollower.java          |   2 +-
 .../reservation/CapacityOverTimePolicy.java     |   6 +-
 .../reservation/ReservationSystemUtil.java      |   2 +-
 .../planning/StageEarliestStartByDemand.java    |   2 +-
 .../rmcontainer/RMContainerImpl.java            |   2 +-
 .../scheduler/ClusterNodeTracker.java           |  10 +-
 .../resourcemanager/scheduler/QueueMetrics.java |  61 +--
 .../scheduler/SchedulerApplicationAttempt.java  |   6 +-
 .../scheduler/SchedulerUtils.java               |   8 +-
 .../scheduler/capacity/CSQueueMetrics.java      |  24 +-
 .../capacity/CapacityHeadroomProvider.java      |   2 +-
 .../CapacitySchedulerConfiguration.java         |   6 +-
 .../scheduler/capacity/LeafQueue.java           |   2 +-
 .../allocator/RegularContainerAllocator.java    |   2 +-
 .../scheduler/fair/FSAppAttempt.java            |   2 +-
 .../scheduler/fair/FSParentQueue.java           |   2 +-
 .../resourcemanager/scheduler/fair/FSQueue.java |  12 +-
 .../scheduler/fair/FSQueueMetrics.java          |  41 +-
 .../scheduler/fair/FairScheduler.java           |   6 +-
 .../fair/policies/ComputeFairShares.java        |  18 +-
 .../DominantResourceFairnessPolicy.java         |  10 +-
 .../fair/policies/FairSharePolicy.java          |  20 +-
 .../scheduler/fair/policies/FifoPolicy.java     |   8 +-
 .../scheduler/fifo/FifoScheduler.java           |  15 +-
 .../scheduler/policy/FairOrderingPolicy.java    |   5 +-
 .../webapp/DefaultSchedulerPage.java            |   4 +-
 .../webapp/FairSchedulerAppsBlock.java          |   2 +-
 .../resourcemanager/webapp/RMWebServices.java   |   8 +-
 .../resourcemanager/webapp/dao/AppInfo.java     |  20 +-
 .../webapp/dao/FairSchedulerInfo.java           |   4 +-
 .../webapp/dao/FairSchedulerQueueInfo.java      |  14 +-
 .../webapp/dao/FifoSchedulerInfo.java           |  18 +-
 .../resourcemanager/webapp/dao/NodeInfo.java    |   4 +-
 .../webapp/dao/ResourceInfo.java                |  10 +-
 .../server/resourcemanager/Application.java     |   2 +-
 .../yarn/server/resourcemanager/MockNM.java     |   8 +-
 .../yarn/server/resourcemanager/MockNodes.java  |   4 +-
 .../server/resourcemanager/NodeManager.java     |   8 +-
 .../ReservationACLsTestBase.java                |   2 +-
 .../resourcemanager/TestApplicationACLs.java    |   6 +-
 .../resourcemanager/TestApplicationCleanup.java |   2 +-
 .../TestContainerResourceUsage.java             |   2 +-
 .../TestDistributedSchedulingService.java       |   2 +-
 .../yarn/server/resourcemanager/TestRM.java     |   8 +-
 .../yarn/server/resourcemanager/TestRMHA.java   |   4 +-
 .../resourcemanager/TestRMNodeTransitions.java  |  22 +-
 .../TestReservationSystemWithRMHA.java          |   2 +-
 .../TestResourceTrackerService.java             |   2 +-
 .../TestWorkPreservingRMRestart.java            |  29 +-
 .../metrics/TestSystemMetricsPublisher.java     |  10 +-
 ...alCapacityPreemptionPolicyMockFramework.java |   4 +-
 ...estProportionalCapacityPreemptionPolicy.java |  39 +-
 ...alCapacityPreemptionPolicyMockFramework.java |   6 +-
 .../nodelabels/TestRMNodeLabelsManager.java     |   2 +-
 .../reservation/ReservationSystemTestUtil.java  |   2 +-
 .../TestRLESparseResourceAllocation.java        |  18 +-
 .../planning/TestSimpleCapacityReplanner.java   |   4 +-
 .../scheduler/TestAbstractYarnScheduler.java    |  16 +-
 .../scheduler/TestQueueMetrics.java             |   8 +-
 .../scheduler/TestResourceUsage.java            |   2 +-
 .../scheduler/TestSchedulerUtils.java           |  20 +-
 .../capacity/TestApplicationLimits.java         |   6 +-
 .../capacity/TestApplicationPriority.java       |  52 +-
 .../capacity/TestCapacityScheduler.java         | 121 ++---
 .../TestCapacitySchedulerLazyPreemption.java    |  30 +-
 .../TestCapacitySchedulerNodeLabelUpdate.java   |  52 +-
 ...TestCapacitySchedulerSurgicalPreemption.java |   4 +-
 .../scheduler/capacity/TestChildQueueOrder.java |   4 +-
 .../capacity/TestContainerAllocation.java       |  53 +-
 .../capacity/TestContainerResizing.java         | 150 +++---
 .../capacity/TestIncreaseAllocationExpirer.java |  36 +-
 .../scheduler/capacity/TestLeafQueue.java       | 492 +++++++++----------
 .../TestNodeLabelContainerAllocation.java       |  15 +-
 .../scheduler/capacity/TestParentQueue.java     |   4 +-
 .../scheduler/capacity/TestQueueCapacities.java |   2 +-
 .../scheduler/capacity/TestReservations.java    | 406 +++++++--------
 ...TestWorkPreservingRMRestartForNodeLabel.java |   4 +-
 .../scheduler/fair/FairSchedulerTestBase.java   |   4 +-
 .../scheduler/fair/TestComputeFairShares.java   |   2 +-
 .../fair/TestContinuousScheduling.java          |   2 +-
 .../scheduler/fair/TestFSAppAttempt.java        |  32 +-
 .../scheduler/fair/TestFSLeafQueue.java         |  15 +-
 .../scheduler/fair/TestFairScheduler.java       | 286 +++++------
 .../fair/TestFairSchedulerFairShare.java        |  32 +-
 .../fair/TestFairSchedulerPreemption.java       |  62 +--
 .../scheduler/fifo/TestFifoScheduler.java       |  63 +--
 .../webapp/TestRMWebServicesApps.java           |   2 +-
 .../webapp/TestRMWebServicesNodes.java          |   4 +-
 139 files changed, 1595 insertions(+), 1572 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
index 47d2389..b6c0300 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java
@@ -689,9 +689,9 @@ public class JobHistoryEventHandler extends AbstractService
       NormalizedResourceEvent normalizedResourceEvent = 
             (NormalizedResourceEvent) event;
       if (normalizedResourceEvent.getTaskType() == TaskType.MAP) {
-        summary.setResourcesPerMap(normalizedResourceEvent.getMemory());
+        summary.setResourcesPerMap((int) normalizedResourceEvent.getMemory());
       } else if (normalizedResourceEvent.getTaskType() == TaskType.REDUCE) {
-        summary.setResourcesPerReduce(normalizedResourceEvent.getMemory());
+        summary.setResourcesPerReduce((int) normalizedResourceEvent.getMemory());
       }
       break;  
     case JOB_INITED:

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
index da6617e..e03aafa 100755
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
@@ -1425,7 +1425,7 @@ public abstract class TaskAttemptImpl implements
     }
     long duration = (taskAttempt.getFinishTime() - taskAttempt.getLaunchTime());
     Resource allocatedResource = taskAttempt.container.getResource();
-    int mbAllocated = allocatedResource.getMemory();
+    int mbAllocated = (int) allocatedResource.getMemorySize();
     int vcoresAllocated = allocatedResource.getVirtualCores();
     int minSlotMemSize = taskAttempt.conf.getInt(
         YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB,

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java
index 94b5c16..eb847d6 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java
@@ -371,10 +371,10 @@ public class RMContainerAllocator extends RMContainerRequestor
           eventHandler.handle(new JobHistoryEvent(jobId,
             new NormalizedResourceEvent(
               org.apache.hadoop.mapreduce.TaskType.MAP, mapResourceRequest
-                .getMemory())));
+                .getMemorySize())));
           LOG.info("mapResourceRequest:" + mapResourceRequest);
-          if (mapResourceRequest.getMemory() > supportedMaxContainerCapability
-            .getMemory()
+          if (mapResourceRequest.getMemorySize() > supportedMaxContainerCapability
+            .getMemorySize()
               || mapResourceRequest.getVirtualCores() > supportedMaxContainerCapability
                 .getVirtualCores()) {
             String diagMsg =
@@ -388,7 +388,7 @@ public class RMContainerAllocator extends RMContainerRequestor
           }
         }
         // set the resources
-        reqEvent.getCapability().setMemory(mapResourceRequest.getMemory());
+        reqEvent.getCapability().setMemory(mapResourceRequest.getMemorySize());
         reqEvent.getCapability().setVirtualCores(
           mapResourceRequest.getVirtualCores());
         scheduledRequests.addMap(reqEvent);//maps are immediately scheduled
@@ -398,10 +398,10 @@ public class RMContainerAllocator extends RMContainerRequestor
           eventHandler.handle(new JobHistoryEvent(jobId,
             new NormalizedResourceEvent(
               org.apache.hadoop.mapreduce.TaskType.REDUCE,
-              reduceResourceRequest.getMemory())));
+              reduceResourceRequest.getMemorySize())));
           LOG.info("reduceResourceRequest:" + reduceResourceRequest);
-          if (reduceResourceRequest.getMemory() > supportedMaxContainerCapability
-            .getMemory()
+          if (reduceResourceRequest.getMemorySize() > supportedMaxContainerCapability
+            .getMemorySize()
               || reduceResourceRequest.getVirtualCores() > supportedMaxContainerCapability
                 .getVirtualCores()) {
             String diagMsg =
@@ -416,7 +416,7 @@ public class RMContainerAllocator extends RMContainerRequestor
           }
         }
         // set the resources
-        reqEvent.getCapability().setMemory(reduceResourceRequest.getMemory());
+        reqEvent.getCapability().setMemory(reduceResourceRequest.getMemorySize());
         reqEvent.getCapability().setVirtualCores(
           reduceResourceRequest.getVirtualCores());
         if (reqEvent.getEarlierAttemptFailed()) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/ResourceCalculatorUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/ResourceCalculatorUtils.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/ResourceCalculatorUtils.java
index 39cb22e..4748dfd 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/ResourceCalculatorUtils.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/ResourceCalculatorUtils.java
@@ -20,43 +20,42 @@ package org.apache.hadoop.mapreduce.v2.app.rm;
 
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.proto.YarnServiceProtos.SchedulerResourceTypes;
-import org.apache.hadoop.yarn.util.Records;
 
 import java.util.EnumSet;
 
 public class ResourceCalculatorUtils {
-  public static int divideAndCeil(int a, int b) {
+  public static int divideAndCeil(long a, long b) {
     if (b == 0) {
       return 0;
     }
-    return (a + (b - 1)) / b;
+    return (int) ((a + (b - 1)) / b);
   }
 
   public static int computeAvailableContainers(Resource available,
       Resource required, EnumSet<SchedulerResourceTypes> resourceTypes) {
     if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
       return Math.min(
-        calculateRatioOrMaxValue(available.getMemory(), required.getMemory()),
+        calculateRatioOrMaxValue(available.getMemorySize(), required.getMemorySize()),
         calculateRatioOrMaxValue(available.getVirtualCores(), required
             .getVirtualCores()));
     }
     return calculateRatioOrMaxValue(
-      available.getMemory(), required.getMemory());
+      available.getMemorySize(), required.getMemorySize());
   }
 
   public static int divideAndCeilContainers(Resource required, Resource factor,
       EnumSet<SchedulerResourceTypes> resourceTypes) {
     if (resourceTypes.contains(SchedulerResourceTypes.CPU)) {
-      return Math.max(divideAndCeil(required.getMemory(), factor.getMemory()),
+      return Math.max(divideAndCeil(required.getMemorySize(), factor.getMemorySize()),
         divideAndCeil(required.getVirtualCores(), factor.getVirtualCores()));
     }
-    return divideAndCeil(required.getMemory(), factor.getMemory());
+    return divideAndCeil(required.getMemorySize(), factor.getMemorySize());
   }
 
-  private static int calculateRatioOrMaxValue(int numerator, int denominator) {
+  private static int calculateRatioOrMaxValue(long numerator, long denominator) {
     if (denominator == 0) {
       return Integer.MAX_VALUE;
     }
-    return numerator / denominator;
+    return (int) (numerator / denominator);
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/preemption/CheckpointAMPreemptionPolicy.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/preemption/CheckpointAMPreemptionPolicy.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/preemption/CheckpointAMPreemptionPolicy.java
index ce4ec71..b0e399f 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/preemption/CheckpointAMPreemptionPolicy.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/preemption/CheckpointAMPreemptionPolicy.java
@@ -157,7 +157,7 @@ public class CheckpointAMPreemptionPolicy implements AMPreemptionPolicy {
         int pendingPreemptionRam = 0;
         int pendingPreemptionCores = 0;
         for (Resource r : pendingFlexiblePreemptions.values()) {
-          pendingPreemptionRam += r.getMemory();
+          pendingPreemptionRam += r.getMemorySize();
           pendingPreemptionCores += r.getVirtualCores();
         }
 
@@ -171,8 +171,8 @@ public class CheckpointAMPreemptionPolicy implements AMPreemptionPolicy {
 
           LOG.info("ResourceRequest:" + reqRsrc);
           int reqCont = reqRsrc.getNumContainers();
-          int reqMem = reqRsrc.getCapability().getMemory();
-          int totalMemoryToRelease = reqCont * reqMem;
+          long reqMem = reqRsrc.getCapability().getMemorySize();
+          long totalMemoryToRelease = reqCont * reqMem;
           int reqCores = reqRsrc.getCapability().getVirtualCores();
           int totalCoresToRelease = reqCont * reqCores;
 
@@ -204,7 +204,7 @@ public class CheckpointAMPreemptionPolicy implements AMPreemptionPolicy {
               break;
             }
             TaskAttemptId reduceId = ctxt.getTaskAttempt(cont.getId());
-            int cMem = cont.getResource().getMemory();
+            int cMem = (int) cont.getResource().getMemorySize();
             int cCores = cont.getResource().getVirtualCores();
 
             if (!toBePreempted.contains(reduceId)) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestCheckpointPreemptionPolicy.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestCheckpointPreemptionPolicy.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestCheckpointPreemptionPolicy.java
index 59ce4a5..9a5d3a5 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestCheckpointPreemptionPolicy.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestCheckpointPreemptionPolicy.java
@@ -103,7 +103,7 @@ public class TestCheckpointPreemptionPolicy {
          assignedContainers.entrySet()) {
       System.out.println("cont:" + ent.getKey().getContainerId() +
           " type:" + ent.getValue().getTaskId().getTaskType() +
-          " res:" + contToResourceMap.get(ent.getKey()).getMemory() + "MB" );
+          " res:" + contToResourceMap.get(ent.getKey()).getMemorySize() + "MB" );
     }
   }
 
@@ -180,8 +180,8 @@ public class TestCheckpointPreemptionPolicy {
     CheckpointAMPreemptionPolicy policy = new CheckpointAMPreemptionPolicy();
     policy.init(mActxt);
 
-    int supposedMemPreemption = pM.getContract().getResourceRequest()
-        .get(0).getResourceRequest().getCapability().getMemory()
+    int supposedMemPreemption = (int) pM.getContract().getResourceRequest()
+        .get(0).getResourceRequest().getCapability().getMemorySize()
         * pM.getContract().getResourceRequest().get(0).getResourceRequest()
         .getNumContainers();
 
@@ -240,11 +240,11 @@ public class TestCheckpointPreemptionPolicy {
     }
 
     // preempt enough
-    assert (effectivelyPreempted.getMemory() >= supposedMemPreemption)
-      : " preempted: " + effectivelyPreempted.getMemory();
+    assert (effectivelyPreempted.getMemorySize() >= supposedMemPreemption)
+      : " preempted: " + effectivelyPreempted.getMemorySize();
 
     // preempt not too much enough
-    assert effectivelyPreempted.getMemory() <= supposedMemPreemption + minAlloc;
+    assert effectivelyPreempted.getMemorySize() <= supposedMemPreemption + minAlloc;
     return preempting;
   }
 
@@ -261,8 +261,8 @@ public class TestCheckpointPreemptionPolicy {
       Resources.addTo(tot,
           resPerCont.get(c));
     }
-    int numCont = (int) Math.ceil(tot.getMemory() /
-              (double) minimumAllocation.getMemory());
+    int numCont = (int) Math.ceil(tot.getMemorySize() /
+              (double) minimumAllocation.getMemorySize());
     ResourceRequest rr = ResourceRequest.newInstance(
         Priority.newInstance(0), ResourceRequest.ANY,
         minimumAllocation, numCont);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
index 0f11238..4c6ee72 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
@@ -1794,7 +1794,7 @@ public class TestRecovery {
     int appAttemptId = 3;
     MRAppMetrics metrics = mock(MRAppMetrics.class);
     Resource minContainerRequirements = mock(Resource.class);
-    when(minContainerRequirements.getMemory()).thenReturn(1000);
+    when(minContainerRequirements.getMemorySize()).thenReturn(1000L);
 
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     AppContext appContext = mock(AppContext.class);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java
index 98dffba..1af60d8 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java
@@ -33,12 +33,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.hadoop.mapreduce.jobhistory.NormalizedResourceEvent;
-import org.apache.hadoop.mapreduce.v2.app.client.ClientService;
-import org.apache.hadoop.mapreduce.v2.app.rm.ContainerAllocator;
-import org.apache.hadoop.mapreduce.v2.app.rm.ContainerAllocatorEvent;
-import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
-import org.apache.hadoop.yarn.util.resource.Resources;
 import org.junit.Assert;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -47,11 +41,9 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.MapTaskAttemptImpl;
-import org.apache.hadoop.mapreduce.JobID;
 import org.apache.hadoop.mapreduce.Counters;
 import org.apache.hadoop.mapreduce.JobCounter;
 import org.apache.hadoop.mapreduce.MRJobConfig;
-import org.apache.hadoop.mapreduce.TypeConverter;
 import org.apache.hadoop.mapreduce.jobhistory.JobHistoryEvent;
 import org.apache.hadoop.mapreduce.jobhistory.TaskAttemptUnsuccessfulCompletion;
 import org.apache.hadoop.mapreduce.split.JobSplit.TaskSplitMetaInfo;
@@ -94,7 +86,6 @@ import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.NodeId;
-import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.Event;
@@ -313,7 +304,7 @@ public class TestTaskAttempt{
     Assert.assertEquals(rta.getLaunchTime(), 10);
     Counters counters = job.getAllCounters();
 
-    int memoryMb = containerResource.getMemory();
+    int memoryMb = (int) containerResource.getMemorySize();
     int vcores = containerResource.getVirtualCores();
     Assert.assertEquals((int) Math.ceil((float) memoryMb / minContainerSize),
         counters.findCounter(JobCounter.SLOTS_MILLIS_MAPS).getValue());
@@ -577,7 +568,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
     setupTaskAttemptFinishingMonitor(eventHandler, jobConf, appCtx);
 
     TaskAttemptImpl taImpl =
@@ -635,7 +626,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
     setupTaskAttemptFinishingMonitor(eventHandler, jobConf, appCtx);
 
     TaskAttemptImpl taImpl =
@@ -699,7 +690,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
     setupTaskAttemptFinishingMonitor(eventHandler, jobConf, appCtx);
 
     TaskAttemptImpl taImpl =
@@ -769,7 +760,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
     setupTaskAttemptFinishingMonitor(eventHandler, jobConf, appCtx);
 
     TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler,
@@ -826,7 +817,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
     setupTaskAttemptFinishingMonitor(eventHandler, jobConf, appCtx);
 
     TaskAttemptImpl taImpl =
@@ -894,7 +885,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
     setupTaskAttemptFinishingMonitor(eventHandler, jobConf, appCtx);
 
     TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler,
@@ -1054,7 +1045,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
 
     TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler,
         jobFile, 1, splits, jobConf, taListener, new Token(),
@@ -1108,7 +1099,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
 
     TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler,
         jobFile, 1, splits, jobConf, taListener, new Token(),
@@ -1165,7 +1156,7 @@ public class TestTaskAttempt{
     ClusterInfo clusterInfo = mock(ClusterInfo.class);
     Resource resource = mock(Resource.class);
     when(appCtx.getClusterInfo()).thenReturn(clusterInfo);
-    when(resource.getMemory()).thenReturn(1024);
+    when(resource.getMemorySize()).thenReturn(1024L);
 
     TaskAttemptImpl taImpl = new MapTaskAttemptImpl(taskId, 1, eventHandler,
         jobFile, 1, splits, jobConf, taListener, new Token(),

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/local/TestLocalContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/local/TestLocalContainerAllocator.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/local/TestLocalContainerAllocator.java
index 0f7dc87..f9e4595b 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/local/TestLocalContainerAllocator.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/local/TestLocalContainerAllocator.java
@@ -201,7 +201,7 @@ public class TestLocalContainerAllocator {
     Container container = containerAssignedCaptor.getValue().getContainer();
     Resource containerResource = container.getResource();
     Assert.assertNotNull(containerResource);
-    Assert.assertEquals(containerResource.getMemory(), 0);
+    Assert.assertEquals(containerResource.getMemorySize(), 0);
     Assert.assertEquals(containerResource.getVirtualCores(), 0);
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
index 83f03ca..52715d8 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestRMContainerAllocator.java
@@ -1772,7 +1772,7 @@ public class TestRMContainerAllocator {
         when(excessC.getId()).thenReturn(containerId);
         when(excessC.getPriority()).thenReturn(RMContainerAllocator.PRIORITY_REDUCE);
         Resource mockR = mock(Resource.class);
-        when(mockR.getMemory()).thenReturn(2048);
+        when(mockR.getMemorySize()).thenReturn(2048L);
         when(excessC.getResource()).thenReturn(mockR);
         NodeId nId = mock(NodeId.class);
         when(nId.getHost()).thenReturn("local");

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestResourceCalculatorUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestResourceCalculatorUtils.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestResourceCalculatorUtils.java
index d87f6db..cab8f54 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestResourceCalculatorUtils.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/rm/TestResourceCalculatorUtils.java
@@ -47,8 +47,8 @@ public class TestResourceCalculatorUtils {
         Integer.MAX_VALUE,
         expectedNumberOfContainersForCPU);
 
-    Resource zeroCpuResource = Resource.newInstance(nonZeroResource.getMemory(),
-        0);
+    Resource zeroCpuResource = Resource.newInstance(
+        nonZeroResource.getMemorySize(), 0);
 
     verifyDifferentResourceTypes(clusterAvailableResources, zeroCpuResource,
         expectedNumberOfContainersForMemory,

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
index d895c3b..ca38bab 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapreduce/TypeConverter.java
@@ -521,13 +521,13 @@ public class TypeConverter {
         application.getApplicationResourceUsageReport();
     if (resourceUsageReport != null) {
       jobStatus.setNeededMem(
-          resourceUsageReport.getNeededResources().getMemory());
+          resourceUsageReport.getNeededResources().getMemorySize());
       jobStatus.setNumReservedSlots(
           resourceUsageReport.getNumReservedContainers());
       jobStatus.setNumUsedSlots(resourceUsageReport.getNumUsedContainers());
       jobStatus.setReservedMem(
-          resourceUsageReport.getReservedResources().getMemory());
-      jobStatus.setUsedMem(resourceUsageReport.getUsedResources().getMemory());
+          resourceUsageReport.getReservedResources().getMemorySize());
+      jobStatus.setUsedMem(resourceUsageReport.getUsedResources().getMemorySize());
     }
     return jobStatus;
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobStatus.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobStatus.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobStatus.java
index 9ff75b9..7438296 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobStatus.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobStatus.java
@@ -95,9 +95,9 @@ public class JobStatus implements Writable, Cloneable {
   private String trackingUrl ="";
   private int numUsedSlots;
   private int numReservedSlots;
-  private int usedMem;
-  private int reservedMem;
-  private int neededMem;
+  private long usedMem;
+  private long reservedMem;
+  private long neededMem;
   private boolean isUber;
     
   /**
@@ -580,42 +580,42 @@ public class JobStatus implements Writable, Cloneable {
   /**
    * @return the used memory
    */
-  public int getUsedMem() {
+  public long getUsedMem() {
     return usedMem;
   }
 
   /**
    * @param m the used memory
    */
-  public void setUsedMem(int m) {
+  public void setUsedMem(long m) {
     this.usedMem = m;
   }
 
   /**
    * @return the reserved memory
    */
-  public int getReservedMem() {
+  public long getReservedMem() {
     return reservedMem;
  }
 
   /**
    * @param r the reserved memory
    */
-  public void setReservedMem(int r) {
+  public void setReservedMem(long r) {
     this.reservedMem = r;
   }
 
   /**
    * @return the needed memory
    */
-  public int getNeededMem() {
+  public long getNeededMem() {
   return neededMem;
  }
 
   /**
    * @param n the needed memory
    */
-  public void setNeededMem(int n) {
+  public void setNeededMem(long n) {
     this.neededMem = n;
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/NormalizedResourceEvent.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/NormalizedResourceEvent.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/NormalizedResourceEvent.java
index b8f049c..eead9cf 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/NormalizedResourceEvent.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/NormalizedResourceEvent.java
@@ -28,7 +28,7 @@ import org.apache.hadoop.mapreduce.TaskType;
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 public class NormalizedResourceEvent implements HistoryEvent {
-  private int memory;
+  private long memory;
   private TaskType taskType;
   
   /**
@@ -36,7 +36,7 @@ public class NormalizedResourceEvent implements HistoryEvent {
    * @param taskType the tasktype of the request.
    * @param memory the normalized memory requirements.
    */
-  public NormalizedResourceEvent(TaskType taskType, int memory) {
+  public NormalizedResourceEvent(TaskType taskType, long memory) {
     this.memory = memory;
     this.taskType = taskType;
   }
@@ -53,7 +53,7 @@ public class NormalizedResourceEvent implements HistoryEvent {
    * the normalized memory
    * @return the normalized memory
    */
-  public int getMemory() {
+  public long getMemory() {
     return this.memory;
   }
   

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
index 924af58..5553f83 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/tools/CLI.java
@@ -786,9 +786,9 @@ public class CLI extends Configured implements Tool {
     for (JobStatus job : jobs) {
       int numUsedSlots = job.getNumUsedSlots();
       int numReservedSlots = job.getNumReservedSlots();
-      int usedMem = job.getUsedMem();
-      int rsvdMem = job.getReservedMem();
-      int neededMem = job.getNeededMem();
+      long usedMem = job.getUsedMem();
+      long rsvdMem = job.getReservedMem();
+      long neededMem = job.getNeededMem();
       int jobNameLength = job.getJobName().length();
       writer.printf(dataPattern, job.getJobID().toString(),
           job.getJobName().substring(0, jobNameLength > 20 ? 20 : jobNameLength),

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/JobClientUnitTest.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/JobClientUnitTest.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/JobClientUnitTest.java
index 84b76bf..4895a5b 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/JobClientUnitTest.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/JobClientUnitTest.java
@@ -170,9 +170,9 @@ public class JobClientUnitTest {
     when(mockJobStatus.getPriority()).thenReturn(JobPriority.NORMAL);
     when(mockJobStatus.getNumUsedSlots()).thenReturn(1);
     when(mockJobStatus.getNumReservedSlots()).thenReturn(1);
-    when(mockJobStatus.getUsedMem()).thenReturn(1024);
-    when(mockJobStatus.getReservedMem()).thenReturn(512);
-    when(mockJobStatus.getNeededMem()).thenReturn(2048);
+    when(mockJobStatus.getUsedMem()).thenReturn(1024L);
+    when(mockJobStatus.getReservedMem()).thenReturn(512L);
+    when(mockJobStatus.getNeededMem()).thenReturn(2048L);
     when(mockJobStatus.getSchedulingInfo()).thenReturn("NA");
 
     Job mockJob = mock(Job.class);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/FairSchedulerMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/FairSchedulerMetrics.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/FairSchedulerMetrics.java
index d100e1d..3b539fa 100644
--- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/FairSchedulerMetrics.java
+++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/FairSchedulerMetrics.java
@@ -67,10 +67,10 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
     FairScheduler fair = (FairScheduler) scheduler;
     final FSAppAttempt app = fair.getSchedulerApp(appAttemptId);
     metrics.register("variable.app." + oldAppId + ".demand.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return app.getDemand().getMemory();
+        public Long getValue() {
+          return app.getDemand().getMemorySize();
         }
       }
     );
@@ -83,10 +83,10 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
       }
     );
     metrics.register("variable.app." + oldAppId + ".usage.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return app.getResourceUsage().getMemory();
+        public Long getValue() {
+          return app.getResourceUsage().getMemorySize();
         }
       }
     );
@@ -99,26 +99,26 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
       }
     );
     metrics.register("variable.app." + oldAppId + ".minshare.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return app.getMinShare().getMemory();
+        public Long getValue() {
+          return app.getMinShare().getMemorySize();
         }
       }
     );
     metrics.register("variable.app." + oldAppId + ".minshare.vcores",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return app.getMinShare().getMemory();
+        public Long getValue() {
+          return app.getMinShare().getMemorySize();
         }
       }
     );
     metrics.register("variable.app." + oldAppId + ".maxshare.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return Math.min(app.getMaxShare().getMemory(), totalMemoryMB);
+        public Long getValue() {
+          return Math.min(app.getMaxShare().getMemorySize(), totalMemoryMB);
         }
       }
     );
@@ -154,10 +154,10 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
     FairScheduler fair = (FairScheduler) scheduler;
     final FSQueue queue = fair.getQueueManager().getQueue(queueName);
     metrics.register("variable.queue." + queueName + ".demand.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return queue.getDemand().getMemory();
+        public Long getValue() {
+          return queue.getDemand().getMemorySize();
         }
       }
     );
@@ -170,10 +170,10 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
       }
     );
     metrics.register("variable.queue." + queueName + ".usage.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return queue.getResourceUsage().getMemory();
+        public Long getValue() {
+          return queue.getResourceUsage().getMemorySize();
         }
       }
     );
@@ -186,10 +186,10 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
       }
     );
     metrics.register("variable.queue." + queueName + ".minshare.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return queue.getMinShare().getMemory();
+        public Long getValue() {
+          return queue.getMinShare().getMemorySize();
         }
       }
     );
@@ -202,9 +202,9 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
       }
     );
     metrics.register("variable.queue." + queueName + ".maxshare.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if (! maxReset &&
                   SLSRunner.simulateInfoMap.containsKey("Number of nodes") &&
                   SLSRunner.simulateInfoMap.containsKey("Node memory (MB)") &&
@@ -221,7 +221,7 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
             maxReset = false;
           }
 
-          return Math.min(queue.getMaxShare().getMemory(), totalMemoryMB);
+          return Math.min(queue.getMaxShare().getMemorySize(), totalMemoryMB);
         }
       }
     );
@@ -234,10 +234,10 @@ public class FairSchedulerMetrics extends SchedulerMetrics {
       }
     );
     metrics.register("variable.queue." + queueName + ".fairshare.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
-          return queue.getFairShare().getMemory();
+        public Long getValue() {
+          return queue.getFairShare().getMemorySize();
         }
       }
     );

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java
index 1bc6f23..014aa89 100644
--- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java
+++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/ResourceSchedulerWrapper.java
@@ -266,7 +266,7 @@ final public class ResourceSchedulerWrapper
           // should have one container which is AM container
           RMContainer rmc = app.getLiveContainers().iterator().next();
           updateQueueMetrics(queue,
-                  rmc.getContainer().getResource().getMemory(),
+                  rmc.getContainer().getResource().getMemorySize(),
                   rmc.getContainer().getResource().getVirtualCores());
         }
       }
@@ -322,7 +322,7 @@ final public class ResourceSchedulerWrapper
         if (status.getExitStatus() == ContainerExitStatus.SUCCESS) {
           for (RMContainer rmc : app.getLiveContainers()) {
             if (rmc.getContainerId() == containerId) {
-              releasedMemory += rmc.getContainer().getResource().getMemory();
+              releasedMemory += rmc.getContainer().getResource().getMemorySize();
               releasedVCores += rmc.getContainer()
                       .getResource().getVirtualCores();
               break;
@@ -331,7 +331,7 @@ final public class ResourceSchedulerWrapper
         } else if (status.getExitStatus() == ContainerExitStatus.ABORTED) {
           if (preemptionContainerMap.containsKey(containerId)) {
             Resource preResource = preemptionContainerMap.get(containerId);
-            releasedMemory += preResource.getMemory();
+            releasedMemory += preResource.getMemorySize();
             releasedVCores += preResource.getVirtualCores();
             preemptionContainerMap.remove(containerId);
           }
@@ -422,9 +422,9 @@ final public class ResourceSchedulerWrapper
             "counter.queue." + queueName + ".pending.cores",
             "counter.queue." + queueName + ".allocated.memory",
             "counter.queue." + queueName + ".allocated.cores"};
-    int values[] = new int[]{pendingResource.getMemory(),
+    long values[] = new long[]{pendingResource.getMemorySize(),
             pendingResource.getVirtualCores(),
-            allocatedResource.getMemory(), allocatedResource.getVirtualCores()};
+            allocatedResource.getMemorySize(), allocatedResource.getVirtualCores()};
     for (int i = names.length - 1; i >= 0; i --) {
       if (! counterMap.containsKey(names[i])) {
         metrics.counter(names[i]);
@@ -530,11 +530,11 @@ final public class ResourceSchedulerWrapper
 
   private void registerClusterResourceMetrics() {
     metrics.register("variable.cluster.allocated.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if(scheduler == null || scheduler.getRootQueueMetrics() == null) {
-            return 0;
+            return 0L;
           } else {
             return scheduler.getRootQueueMetrics().getAllocatedMB();
           }
@@ -542,11 +542,11 @@ final public class ResourceSchedulerWrapper
       }
     );
     metrics.register("variable.cluster.allocated.vcores",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if(scheduler == null || scheduler.getRootQueueMetrics() == null) {
-            return 0;
+            return 0L;
           } else {
             return scheduler.getRootQueueMetrics().getAllocatedVirtualCores();
           }
@@ -554,11 +554,11 @@ final public class ResourceSchedulerWrapper
       }
     );
     metrics.register("variable.cluster.available.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if(scheduler == null || scheduler.getRootQueueMetrics() == null) {
-            return 0;
+            return 0L;
           } else {
             return scheduler.getRootQueueMetrics().getAvailableMB();
           }
@@ -566,11 +566,11 @@ final public class ResourceSchedulerWrapper
       }
     );
     metrics.register("variable.cluster.available.vcores",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if(scheduler == null || scheduler.getRootQueueMetrics() == null) {
-            return 0;
+            return 0L;
           } else {
             return scheduler.getRootQueueMetrics().getAvailableVirtualCores();
           }
@@ -748,7 +748,7 @@ final public class ResourceSchedulerWrapper
   }
 
   private void updateQueueMetrics(String queue,
-                                  int releasedMemory, int releasedVCores) {
+                                  long releasedMemory, int releasedVCores) {
     // update queue counters
     SortedMap<String, Counter> counterMap = metrics.getCounters();
     if (releasedMemory != 0) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java
index 3626027..5cd53fe 100644
--- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java
+++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/SLSCapacityScheduler.java
@@ -240,7 +240,7 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
 	          // should have one container which is AM container
 	          RMContainer rmc = app.getLiveContainers().iterator().next();
 	          updateQueueMetrics(queue,
-	                  rmc.getContainer().getResource().getMemory(),
+	                  rmc.getContainer().getResource().getMemorySize(),
 	                  rmc.getContainer().getResource().getVirtualCores());
 	        }
 	      }
@@ -299,7 +299,7 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
         if (status.getExitStatus() == ContainerExitStatus.SUCCESS) {
           for (RMContainer rmc : app.getLiveContainers()) {
             if (rmc.getContainerId() == containerId) {
-              releasedMemory += rmc.getContainer().getResource().getMemory();
+              releasedMemory += rmc.getContainer().getResource().getMemorySize();
               releasedVCores += rmc.getContainer()
                       .getResource().getVirtualCores();
               break;
@@ -308,7 +308,7 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
         } else if (status.getExitStatus() == ContainerExitStatus.ABORTED) {
           if (preemptionContainerMap.containsKey(containerId)) {
             Resource preResource = preemptionContainerMap.get(containerId);
-            releasedMemory += preResource.getMemory();
+            releasedMemory += preResource.getMemorySize();
             releasedVCores += preResource.getVirtualCores();
             preemptionContainerMap.remove(containerId);
           }
@@ -399,9 +399,9 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
             "counter.queue." + queueName + ".pending.cores",
             "counter.queue." + queueName + ".allocated.memory",
             "counter.queue." + queueName + ".allocated.cores"};
-    int values[] = new int[]{pendingResource.getMemory(),
+    long values[] = new long[]{pendingResource.getMemorySize(),
             pendingResource.getVirtualCores(),
-            allocatedResource.getMemory(), allocatedResource.getVirtualCores()};
+            allocatedResource.getMemorySize(), allocatedResource.getVirtualCores()};
     for (int i = names.length - 1; i >= 0; i --) {
       if (! counterMap.containsKey(names[i])) {
         metrics.counter(names[i]);
@@ -507,11 +507,11 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
 
   private void registerClusterResourceMetrics() {
     metrics.register("variable.cluster.allocated.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if( getRootQueueMetrics() == null) {
-            return 0;
+            return 0L;
           } else {
             return getRootQueueMetrics().getAllocatedMB();
           }
@@ -519,11 +519,11 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
       }
     );
     metrics.register("variable.cluster.allocated.vcores",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if(getRootQueueMetrics() == null) {
-            return 0;
+            return 0L;
           } else {
             return getRootQueueMetrics().getAllocatedVirtualCores();
           }
@@ -531,11 +531,11 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
       }
     );
     metrics.register("variable.cluster.available.memory",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if(getRootQueueMetrics() == null) {
-            return 0;
+            return 0L;
           } else {
             return getRootQueueMetrics().getAvailableMB();
           }
@@ -543,11 +543,11 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
       }
     );
     metrics.register("variable.cluster.available.vcores",
-      new Gauge<Integer>() {
+      new Gauge<Long>() {
         @Override
-        public Integer getValue() {
+        public Long getValue() {
           if(getRootQueueMetrics() == null) {
-            return 0;
+            return 0l;
           } else {
             return getRootQueueMetrics().getAvailableVirtualCores();
           }
@@ -726,7 +726,7 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
   }
 
   private void updateQueueMetrics(String queue,
-                                  int releasedMemory, int releasedVCores) {
+                                  long releasedMemory, int releasedVCores) {
     // update queue counters
     SortedMap<String, Counter> counterMap = metrics.getCounters();
     if (releasedMemory != 0) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
index 88b57f1..e2d8472 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
@@ -18,7 +18,9 @@
 
 package org.apache.hadoop.yarn.api.records;
 
+import org.apache.hadoop.classification.InterfaceAudience.Private;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
 import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
@@ -53,7 +55,7 @@ public abstract class Resource implements Comparable<Resource> {
 
   @Public
   @Stable
-  public static Resource newInstance(int memory, int vCores) {
+  public static Resource newInstance(long memory, long vCores) {
     Resource resource = Records.newRecord(Resource.class);
     resource.setMemory(memory);
     resource.setVirtualCores(vCores);
@@ -61,12 +63,23 @@ public abstract class Resource implements Comparable<Resource> {
   }
 
   /**
+   * This method is DEPRECATED:
+   * Use {@link Resource#getMemorySize()} instead
+   *
    * Get <em>memory</em> of the resource.
    * @return <em>memory</em> of the resource
    */
   @Public
-  @Stable
+  @Deprecated
   public abstract int getMemory();
+
+  /**
+   * Get <em>memory</em> of the resource.
+   * @return <em>memory</em> of the resource
+   */
+  @Private
+  @Unstable
+  public abstract long getMemorySize();
   
   /**
    * Set <em>memory</em> of the resource.
@@ -74,7 +87,7 @@ public abstract class Resource implements Comparable<Resource> {
    */
   @Public
   @Stable
-  public abstract void setMemory(int memory);
+  public abstract void setMemory(long memory);
 
 
   /**
@@ -90,6 +103,10 @@ public abstract class Resource implements Comparable<Resource> {
   @Public
   @Evolving
   public abstract int getVirtualCores();
+
+  @Public
+  @Unstable
+  public abstract long getVirtualCoresSize();
   
   /**
    * Set <em>number of virtual cpu cores</em> of the resource.
@@ -103,13 +120,14 @@ public abstract class Resource implements Comparable<Resource> {
    */
   @Public
   @Evolving
-  public abstract void setVirtualCores(int vCores);
+  public abstract void setVirtualCores(long vCores);
 
   @Override
   public int hashCode() {
     final int prime = 263167;
-    int result = 3571;
-    result = 939769357 + getMemory(); // prime * result = 939769357 initially
+
+    int result = (int) (939769357
+        + getMemorySize()); // prime * result = 939769357 initially
     result = prime * result + getVirtualCores();
     return result;
   }
@@ -123,7 +141,7 @@ public abstract class Resource implements Comparable<Resource> {
     if (!(obj instanceof Resource))
       return false;
     Resource other = (Resource) obj;
-    if (getMemory() != other.getMemory() || 
+    if (getMemorySize() != other.getMemorySize() ||
         getVirtualCores() != other.getVirtualCores()) {
       return false;
     }
@@ -132,6 +150,6 @@ public abstract class Resource implements Comparable<Resource> {
 
   @Override
   public String toString() {
-    return "<memory:" + getMemory() + ", vCores:" + getVirtualCores() + ">";
+    return "<memory:" + getMemorySize() + ", vCores:" + getVirtualCores() + ">";
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
index 814c5bb..42b5410 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
@@ -54,8 +54,8 @@ message ContainerIdProto {
 }
 
 message ResourceProto {
-  optional int32 memory = 1;
-  optional int32 virtual_cores = 2;
+  optional int64 memory = 1;
+  optional int64 virtual_cores = 2;
 }
 
 message ResourceUtilizationProto {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
index e72adf5..5e2c90b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java
@@ -224,7 +224,7 @@ public class ApplicationMaster {
   @VisibleForTesting
   protected int numTotalContainers = 1;
   // Memory to request for the container on which the shell command will run
-  private int containerMemory = 10;
+  private long containerMemory = 10;
   // VirtualCores to request for the container on which the shell command will run
   private int containerVirtualCores = 1;
   // Priority of the request
@@ -631,7 +631,7 @@ public class ApplicationMaster {
             appMasterTrackingUrl);
     // Dump out information about cluster capability as seen by the
     // resource manager
-    int maxMem = response.getMaximumResourceCapability().getMemory();
+    long maxMem = response.getMaximumResourceCapability().getMemorySize();
     LOG.info("Max mem capability of resources in this cluster " + maxMem);
     
     int maxVCores = response.getMaximumResourceCapability().getVirtualCores();
@@ -861,7 +861,7 @@ public class ApplicationMaster {
             + ":" + allocatedContainer.getNodeId().getPort()
             + ", containerNodeURI=" + allocatedContainer.getNodeHttpAddress()
             + ", containerResourceMemory"
-            + allocatedContainer.getResource().getMemory()
+            + allocatedContainer.getResource().getMemorySize()
             + ", containerResourceVirtualCores"
             + allocatedContainer.getResource().getVirtualCores());
         // + ", containerToken"

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
index 9139b08..5adc37d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
@@ -127,7 +127,7 @@ public class Client {
   // Queue for App master
   private String amQueue = "";
   // Amt. of memory resource to request for to run the App Master
-  private int amMemory = 10; 
+  private long amMemory = 10;
   // Amt. of virtual core resource to request for to run the App Master
   private int amVCores = 1;
 
@@ -520,7 +520,7 @@ public class Client {
     // the required resources from the RM for the app master
     // Memory ask has to be a multiple of min and less than max. 
     // Dump out information about cluster capability as seen by the resource manager
-    int maxMem = appResponse.getMaximumResourceCapability().getMemory();
+    long maxMem = appResponse.getMaximumResourceCapability().getMemorySize();
     LOG.info("Max mem capability of resources in this cluster " + maxMem);
 
     // A resource ask cannot exceed the max. 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java
index 46ddc4d..4366c25 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java
@@ -122,10 +122,10 @@ public class AMRMClientImpl<T extends ContainerRequest> extends AMRMClient<T> {
   class ResourceReverseMemoryThenCpuComparator implements Comparator<Resource> {
     @Override
     public int compare(Resource arg0, Resource arg1) {
-      int mem0 = arg0.getMemory();
-      int mem1 = arg1.getMemory();
-      int cpu0 = arg0.getVirtualCores();
-      int cpu1 = arg1.getVirtualCores();
+      long mem0 = arg0.getMemorySize();
+      long mem1 = arg1.getMemorySize();
+      long cpu0 = arg0.getVirtualCores();
+      long cpu1 = arg1.getVirtualCores();
       if(mem0 == mem1) {
         if(cpu0 == cpu1) {
           return 0;
@@ -143,10 +143,10 @@ public class AMRMClientImpl<T extends ContainerRequest> extends AMRMClient<T> {
   }
   
   static boolean canFit(Resource arg0, Resource arg1) {
-    int mem0 = arg0.getMemory();
-    int mem1 = arg1.getMemory();
-    int cpu0 = arg0.getVirtualCores();
-    int cpu1 = arg1.getVirtualCores();
+    long mem0 = arg0.getMemorySize();
+    long mem1 = arg1.getMemorySize();
+    long cpu0 = arg0.getVirtualCores();
+    long cpu1 = arg1.getVirtualCores();
     
     return (mem0 <= mem1 && cpu0 <= cpu1);
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java
index c112857..a89551f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/NodeCLI.java
@@ -275,9 +275,9 @@ public class NodeCLI extends YarnCLI {
       nodeReportStr.println(nodeReport.getNumContainers());
       nodeReportStr.print("\tMemory-Used : ");
       nodeReportStr.println((nodeReport.getUsed() == null) ? "0MB"
-          : (nodeReport.getUsed().getMemory() + "MB"));
+          : (nodeReport.getUsed().getMemorySize() + "MB"));
       nodeReportStr.print("\tMemory-Capacity : ");
-      nodeReportStr.println(nodeReport.getCapability().getMemory() + "MB");
+      nodeReportStr.println(nodeReport.getCapability().getMemorySize() + "MB");
       nodeReportStr.print("\tCPU-Used : ");
       nodeReportStr.println((nodeReport.getUsed() == null) ? "0 vcores"
           : (nodeReport.getUsed().getVirtualCores() + " vcores"));

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java
index 211f5e8..eca1266 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/TopCLI.java
@@ -158,7 +158,7 @@ public class TopCLI extends YarnCLI {
       displayStringsMap.put(Columns.VCORES, String.valueOf(usedVirtualCores));
       usedMemory =
           appReport.getApplicationResourceUsageReport().getUsedResources()
-            .getMemory() / 1024;
+            .getMemorySize() / 1024;
       displayStringsMap.put(Columns.MEM, String.valueOf(usedMemory) + "G");
       reservedVirtualCores =
           appReport.getApplicationResourceUsageReport().getReservedResources()
@@ -167,7 +167,7 @@ public class TopCLI extends YarnCLI {
           String.valueOf(reservedVirtualCores));
       reservedMemory =
           appReport.getApplicationResourceUsageReport().getReservedResources()
-            .getMemory() / 1024;
+            .getMemorySize() / 1024;
       displayStringsMap.put(Columns.RMEM, String.valueOf(reservedMemory) + "G");
       attempts = appReport.getCurrentApplicationAttemptId().getAttemptId();
       nodes = 0;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java
index df1b96b..9ce7388 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java
@@ -1209,7 +1209,7 @@ public class TestYarnClient {
     for (attempts = 10; attempts > 0; attempts--) {
       if (cluster.getResourceManager().getRMContext().getReservationSystem()
           .getPlan(ReservationSystemTestUtil.reservationQ).getTotalCapacity()
-          .getMemory() > 6000) {
+          .getMemorySize() > 6000) {
         break;
       }
       try {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
index a28c6ed..937941a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ResourcePBImpl.java
@@ -53,39 +53,49 @@ public class ResourcePBImpl extends Resource {
     }
     viaProto = false;
   }
-    
-  
+
   @Override
+  @SuppressWarnings("deprecation")
   public int getMemory() {
+    return (int) getMemorySize();
+  }
+
+  @Override
+  public long getMemorySize() {
     ResourceProtoOrBuilder p = viaProto ? proto : builder;
-    return (p.getMemory());
+    return p.getMemory();
   }
 
   @Override
-  public void setMemory(int memory) {
+  public void setMemory(long memory) {
     maybeInitBuilder();
-    builder.setMemory((memory));
+    builder.setMemory(memory);
   }
 
   @Override
   public int getVirtualCores() {
+    return (int) getVirtualCoresSize();
+  }
+
+  @Override
+  public long getVirtualCoresSize() {
     ResourceProtoOrBuilder p = viaProto ? proto : builder;
-    return (p.getVirtualCores());
+    return p.getVirtualCores();
   }
 
   @Override
-  public void setVirtualCores(int vCores) {
+  public void setVirtualCores(long vCores) {
     maybeInitBuilder();
-    builder.setVirtualCores((vCores));
+    builder.setVirtualCores(vCores);
   }
 
   @Override
   public int compareTo(Resource other) {
-    int diff = this.getMemory() - other.getMemory();
+    long diff = this.getMemorySize() - other.getMemorySize();
     if (diff == 0) {
       diff = this.getVirtualCores() - other.getVirtualCores();
     }
-    return diff;
+    return diff == 0 ? 0 : (diff > 0 ? 1 : -1);
   }
   
   

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42f90ab8/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DefaultResourceCalculator.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DefaultResourceCalculator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DefaultResourceCalculator.java
index 2fdf214..b98cf0c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DefaultResourceCalculator.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DefaultResourceCalculator.java
@@ -28,13 +28,13 @@ public class DefaultResourceCalculator extends ResourceCalculator {
   @Override
   public int compare(Resource unused, Resource lhs, Resource rhs) {
     // Only consider memory
-    return lhs.getMemory() - rhs.getMemory();
+    return Long.compare(lhs.getMemorySize(), rhs.getMemorySize());
   }
 
   @Override
-  public int computeAvailableContainers(Resource available, Resource required) {
+  public long computeAvailableContainers(Resource available, Resource required) {
     // Only consider memory
-    return available.getMemory() / required.getMemory();
+    return available.getMemorySize() / required.getMemorySize();
   }
 
   @Override
@@ -44,7 +44,7 @@ public class DefaultResourceCalculator extends ResourceCalculator {
   }
   
   public boolean isInvalidDivisor(Resource r) {
-    if (r.getMemory() == 0.0f) {
+    if (r.getMemorySize() == 0.0f) {
       return true;
     }
     return false;
@@ -52,23 +52,23 @@ public class DefaultResourceCalculator extends ResourceCalculator {
 
   @Override
   public float ratio(Resource a, Resource b) {
-    return (float)a.getMemory() / b.getMemory();
+    return (float)a.getMemorySize() / b.getMemorySize();
   }
 
   @Override
-  public Resource divideAndCeil(Resource numerator, int denominator) {
+  public Resource divideAndCeil(Resource numerator, long denominator) {
     return Resources.createResource(
-        divideAndCeil(numerator.getMemory(), denominator));
+        divideAndCeil(numerator.getMemorySize(), denominator));
   }
 
   @Override
   public Resource normalize(Resource r, Resource minimumResource,
       Resource maximumResource, Resource stepFactor) {
-    int normalizedMemory = Math.min(
+    long normalizedMemory = Math.min(
         roundUp(
-            Math.max(r.getMemory(), minimumResource.getMemory()),
-            stepFactor.getMemory()),
-            maximumResource.getMemory());
+            Math.max(r.getMemorySize(), minimumResource.getMemorySize()),
+            stepFactor.getMemorySize()),
+            maximumResource.getMemorySize());
     return Resources.createResource(normalizedMemory);
   }
 
@@ -81,22 +81,22 @@ public class DefaultResourceCalculator extends ResourceCalculator {
   @Override
   public Resource roundUp(Resource r, Resource stepFactor) {
     return Resources.createResource(
-        roundUp(r.getMemory(), stepFactor.getMemory())
+        roundUp(r.getMemorySize(), stepFactor.getMemorySize())
         );
   }
 
   @Override
   public Resource roundDown(Resource r, Resource stepFactor) {
     return Resources.createResource(
-        roundDown(r.getMemory(), stepFactor.getMemory()));
+        roundDown(r.getMemorySize(), stepFactor.getMemorySize()));
   }
 
   @Override
   public Resource multiplyAndNormalizeUp(Resource r, double by,
       Resource stepFactor) {
     return Resources.createResource(
-        roundUp((int)(r.getMemory() * by + 0.5), stepFactor.getMemory())
-        );
+        roundUp((long) (r.getMemorySize() * by + 0.5),
+            stepFactor.getMemorySize()));
   }
 
   @Override
@@ -104,8 +104,8 @@ public class DefaultResourceCalculator extends ResourceCalculator {
       Resource stepFactor) {
     return Resources.createResource(
         roundDown(
-            (int)(r.getMemory() * by), 
-            stepFactor.getMemory()
+            (long)(r.getMemorySize() * by),
+            stepFactor.getMemorySize()
             )
         );
   }
@@ -113,6 +113,6 @@ public class DefaultResourceCalculator extends ResourceCalculator {
   @Override
   public boolean fitsIn(Resource cluster,
       Resource smaller, Resource bigger) {
-    return smaller.getMemory() <= bigger.getMemory();
+    return smaller.getMemorySize() <= bigger.getMemorySize();
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message