Explorar o código

YARN-4643. Container recovery is broken with delegating container runtime. Contributed by Sidharta Seethana
(cherry picked from commit 61382ff8fabc76b3a51f227646573cdf367fea1a)

Jason Lowe %!s(int64=9) %!d(string=hai) anos
pai
achega
290b7db656

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

@@ -1175,6 +1175,9 @@ Release 2.8.0 - UNRELEASED
     YARN-4520. Finished app info is unnecessarily persisted in NM state-store
     YARN-4520. Finished app info is unnecessarily persisted in NM state-store
     if container is acquired but not lunched on this node. (sandflee via jianeh)
     if container is acquired but not lunched on this node. (sandflee via jianeh)
 
 
+    YARN-4643. Container recovery is broken with delegating container runtime
+    (Sidharta Seethana via jlowe)
+
 Release 2.7.3 - UNRELEASED
 Release 2.7.3 - UNRELEASED
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 4 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/RecoveredContainerLaunch.java

@@ -83,9 +83,10 @@ public class RecoveredContainerLaunch extends ContainerLaunch {
         exec.activateContainer(containerId, pidFilePath);
         exec.activateContainer(containerId, pidFilePath);
         retCode = exec.reacquireContainer(
         retCode = exec.reacquireContainer(
             new ContainerReacquisitionContext.Builder()
             new ContainerReacquisitionContext.Builder()
-            .setUser(container.getUser())
-            .setContainerId(containerId)
-            .build());
+                .setContainer(container)
+                .setUser(container.getUser())
+                .setContainerId(containerId)
+                .build());
       } else {
       } else {
         LOG.warn("Unable to locate pid file for container " + containerIdStr);
         LOG.warn("Unable to locate pid file for container " + containerIdStr);
       }
       }

+ 9 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestLinuxContainerExecutor.java

@@ -629,7 +629,16 @@ public class TestLinuxContainerExecutor {
     } catch (IOException e) {
     } catch (IOException e) {
       // expected if LCE isn't setup right, but not necessary for this test
       // expected if LCE isn't setup right, but not necessary for this test
     }
     }
+
+    Container container = mock(Container.class);
+    ContainerLaunchContext context = mock(ContainerLaunchContext.class);
+    HashMap<String, String> env = new HashMap<>();
+
+    when(container.getLaunchContext()).thenReturn(context);
+    when(context.getEnvironment()).thenReturn(env);
+
     lce.reacquireContainer(new ContainerReacquisitionContext.Builder()
     lce.reacquireContainer(new ContainerReacquisitionContext.Builder()
+        .setContainer(container)
         .setUser("foouser")
         .setUser("foouser")
         .setContainerId(cid)
         .setContainerId(cid)
         .build());
         .build());