hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ka...@apache.org
Subject svn commit: r1576525 - in /hadoop/common/trunk/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-reso...
Date Tue, 11 Mar 2014 22:18:54 GMT
Author: kasha
Date: Tue Mar 11 22:18:54 2014
New Revision: 1576525

URL: http://svn.apache.org/r1576525
Log:
YARN-1821. NPE on registerNodeManager if the request has containers for UnmanagedAMs (kasha)

Modified:
    hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java
    hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java

Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt?rev=1576525&r1=1576524&r2=1576525&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt Tue Mar 11 22:18:54 2014
@@ -443,6 +443,9 @@ Release 2.4.0 - UNRELEASED
     apps-killed metrics correctly for killed applications. (Varun Vasudev via
     vinodkv)
 
+    YARN-1821. NPE on registerNodeManager if the request has containers for 
+    UnmanagedAMs. (kasha)
+
 Release 2.3.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java?rev=1576525&r1=1576524&r2=1576525&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java
(original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java
Tue Mar 11 22:18:54 2014
@@ -210,14 +210,16 @@ public class ResourceTrackerService exte
             rmContext.getRMApps().get(appAttemptId.getApplicationId());
         if (rmApp != null) {
           RMAppAttempt rmAppAttempt = rmApp.getRMAppAttempt(appAttemptId);
-          if (rmAppAttempt.getMasterContainer().getId()
-              .equals(containerStatus.getContainerId())
-              && containerStatus.getState() == ContainerState.COMPLETE) {
-            // sending master container finished event.
-            RMAppAttemptContainerFinishedEvent evt =
-                new RMAppAttemptContainerFinishedEvent(appAttemptId,
-                    containerStatus);
-            rmContext.getDispatcher().getEventHandler().handle(evt);
+          if (rmAppAttempt != null) {
+            if (rmAppAttempt.getMasterContainer().getId()
+                .equals(containerStatus.getContainerId())
+                && containerStatus.getState() == ContainerState.COMPLETE) {
+              // sending master container finished event.
+              RMAppAttemptContainerFinishedEvent evt =
+                  new RMAppAttemptContainerFinishedEvent(appAttemptId,
+                      containerStatus);
+              rmContext.getDispatcher().getEventHandler().handle(evt);
+            }
           }
         } else {
           LOG.error("Received finished container :"

Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java?rev=1576525&r1=1576524&r2=1576525&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java
(original)
+++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java
Tue Mar 11 22:18:54 2014
@@ -21,6 +21,8 @@ package org.apache.hadoop.yarn.server.re
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 
@@ -29,7 +31,11 @@ import junit.framework.Assert;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 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.ContainerState;
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
 import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.api.records.NodeState;
@@ -42,6 +48,7 @@ import org.apache.hadoop.yarn.server.api
 import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
 import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerResponse;
 import org.apache.hadoop.yarn.server.api.records.NodeAction;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
 import org.apache.hadoop.yarn.server.utils.BuilderUtils;
@@ -50,6 +57,8 @@ import org.apache.hadoop.yarn.util.YarnV
 import org.junit.After;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+
 public class TestResourceTrackerService {
 
   private final static File TEMP_DIR = new File(System.getProperty(
@@ -458,6 +467,28 @@ public class TestResourceTrackerService 
   }
 
   @Test
+  public void testNodeRegistrationWithContainers() throws Exception {
+    MockRM rm = new MockRM();
+    rm.init(new YarnConfiguration());
+    rm.start();
+    RMApp app = rm.submitApp(1024);
+
+    MockNM nm = rm.registerNode("host1:1234", 8192);
+    nm.nodeHeartbeat(true);
+
+    // Register node with some container statuses
+    ContainerStatus status = ContainerStatus.newInstance(
+        ContainerId.newInstance(ApplicationAttemptId.newInstance(
+            app.getApplicationId(), 2), 1),
+        ContainerState.COMPLETE, "Dummy Completed", 0);
+
+    // The following shouldn't throw NPE
+    nm.registerNode(Collections.singletonList(status));
+    assertEquals("Incorrect number of nodes", 1,
+        rm.getRMContext().getRMNodes().size());
+  }
+
+  @Test
   public void testReconnectNode() throws Exception {
     final DrainDispatcher dispatcher = new DrainDispatcher();
     MockRM rm = new MockRM() {



Mime
View raw message