Browse Source

YARN-3160. Fix non-atomic operation on nodeUpdateQueue in RMNodeImpl. (Contributed by Chengbing Liu)

Junping Du 10 years ago
parent
commit
c541a374d8

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -537,6 +537,9 @@ Release 2.7.0 - UNRELEASED
     http(s)://proxy addr:port/proxy/<appId> to avoid duplicate sections. (Devaraj
     K via zjshen)
 
+    YARN-3160. Fix non-atomic operation on nodeUpdateQueue in RMNodeImpl. 
+    (Chengbing Liu via junping_du)
+
 Release 2.6.0 - 2014-11-18
 
   INCOMPATIBLE CHANGES

+ 3 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java

@@ -842,8 +842,9 @@ public class RMNodeImpl implements RMNode, EventHandler<RMNodeEvent> {
   public List<UpdatedContainerInfo> pullContainerUpdates() {
     List<UpdatedContainerInfo> latestContainerInfoList = 
         new ArrayList<UpdatedContainerInfo>();
-    while(nodeUpdateQueue.peek() != null){
-      latestContainerInfoList.add(nodeUpdateQueue.poll());
+    UpdatedContainerInfo containerInfo;
+    while ((containerInfo = nodeUpdateQueue.poll()) != null) {
+      latestContainerInfoList.add(containerInfo);
     }
     this.nextHeartBeat = true;
     return latestContainerInfoList;