diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index c579981c8e..e357080245 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -89,6 +89,9 @@ Release 0.23.1 - Unreleased MAPREDUCE-3342. Fixed JobHistoryServer to also show the job's queue name. (Jonathan Eagles via vinodkv) + MAPREDUCE-3345. Fixed a race condition in ResourceManager that was causing + TestContainerManagerSecurity to fail sometimes. (Hitesh Shah via vinodkv) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index 0d81f80121..71dd982b60 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -595,8 +595,13 @@ public void transition(RMAppAttemptImpl appAttempt, AM_CONTAINER_PRIORITY, "*", appAttempt.submissionContext .getAMContainerSpec().getResource(), 1); - appAttempt.scheduler.allocate(appAttempt.applicationAttemptId, - Collections.singletonList(request), EMPTY_CONTAINER_RELEASE_LIST); + Allocation amContainerAllocation = + appAttempt.scheduler.allocate(appAttempt.applicationAttemptId, + Collections.singletonList(request), EMPTY_CONTAINER_RELEASE_LIST); + if (amContainerAllocation != null + && amContainerAllocation.getContainers() != null) { + assert(amContainerAllocation.getContainers().size() == 0); + } } } diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java index c61c7ab89f..977150520a 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java @@ -236,28 +236,30 @@ public Allocation allocate( RMContainerEventType.RELEASED); } - if (!ask.isEmpty()) { - LOG.debug("allocate: pre-update" + - " applicationId=" + applicationAttemptId + - " application=" + application); - application.showRequests(); + synchronized (application) { + if (!ask.isEmpty()) { + LOG.debug("allocate: pre-update" + + " applicationId=" + applicationAttemptId + + " application=" + application); + application.showRequests(); - // Update application requests - application.updateResourceRequests(ask); + // Update application requests + application.updateResourceRequests(ask); - LOG.debug("allocate: post-update" + - " applicationId=" + applicationAttemptId + - " application=" + application); - application.showRequests(); + LOG.debug("allocate: post-update" + + " applicationId=" + applicationAttemptId + + " application=" + application); + application.showRequests(); - LOG.debug("allocate:" + - " applicationId=" + applicationAttemptId + - " #ask=" + ask.size()); + LOG.debug("allocate:" + + " applicationId=" + applicationAttemptId + + " #ask=" + ask.size()); + } + + return new Allocation( + application.pullNewlyAllocatedContainers(), + application.getHeadroom()); } - - return new Allocation( - application.pullNewlyAllocatedContainers(), - application.getHeadroom()); } private SchedulerApp getApplication(