You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2018/05/23 21:17:59 UTC
[1/5] hadoop git commit: YARN-8344. Missing nm.stop() in
TestNodeManagerResync to fix testKillContainersOnResync. Contributed by
Giovanni Matteo Fumarola.
Repository: hadoop
Updated Branches:
refs/heads/branch-2 c5ff9553f -> 8f43ade46
refs/heads/branch-2.9 8347a6cb7 -> 50347eaf5
refs/heads/branch-3.0 506f61e18 -> 7c5a5f31d
refs/heads/branch-3.1 f57e91a34 -> 61b5b2f4f
refs/heads/trunk cddbbe5f6 -> e99e5bf10
YARN-8344. Missing nm.stop() in TestNodeManagerResync to fix testKillContainersOnResync. Contributed by Giovanni Matteo Fumarola.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e99e5bf1
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e99e5bf1
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e99e5bf1
Branch: refs/heads/trunk
Commit: e99e5bf104e9664bc1b43a2639d87355d47a77e2
Parents: cddbbe5
Author: Inigo Goiri <in...@apache.org>
Authored: Wed May 23 14:15:26 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Wed May 23 14:15:26 2018 -0700
----------------------------------------------------------------------
.../nodemanager/TestNodeManagerResync.java | 87 +++++++++++---------
1 file changed, 48 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e99e5bf1/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
index 97e9922..cf33775 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
@@ -150,7 +150,6 @@ public class TestNodeManagerResync {
testContainerPreservationOnResyncImpl(nm, true);
}
- @SuppressWarnings("unchecked")
protected void testContainerPreservationOnResyncImpl(TestNodeManager1 nm,
boolean isWorkPreservingRestartEnabled)
throws IOException, YarnException, InterruptedException {
@@ -186,32 +185,35 @@ public class TestNodeManagerResync {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=10000)
public void testNMshutdownWhenResyncThrowException() throws IOException,
InterruptedException, YarnException {
NodeManager nm = new TestNodeManager3();
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
- Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
- nm.getNMDispatcher().getEventHandler()
- .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
-
- synchronized (isNMShutdownCalled) {
- while (isNMShutdownCalled.get() == false) {
- try {
- isNMShutdownCalled.wait();
- } catch (InterruptedException e) {
+ try {
+ nm.init(conf);
+ nm.start();
+ Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+
+ synchronized (isNMShutdownCalled) {
+ while (!isNMShutdownCalled.get()) {
+ try {
+ isNMShutdownCalled.wait();
+ } catch (InterruptedException e) {
+ }
}
}
- }
- Assert.assertTrue("NM shutdown not called.",isNMShutdownCalled.get());
- nm.stop();
+ Assert.assertTrue("NM shutdown not called.", isNMShutdownCalled.get());
+ } finally {
+ nm.stop();
+ }
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=60000)
public void testContainerResourceIncreaseIsSynchronizedWithRMResync()
throws IOException, InterruptedException, YarnException {
@@ -219,28 +221,32 @@ public class TestNodeManagerResync {
YarnConfiguration conf = createNMConfig();
conf.setBoolean(
YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, true);
- nm.init(conf);
- nm.start();
- // Start a container and make sure it is in RUNNING state
- ((TestNodeManager4)nm).startContainer();
- // Simulate a container resource increase in a separate thread
- ((TestNodeManager4)nm).updateContainerResource();
- // Simulate RM restart by sending a RESYNC event
- LOG.info("Sending out RESYNC event");
- nm.getNMDispatcher().getEventHandler().handle(
- new NodeManagerEvent(NodeManagerEventType.RESYNC));
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
+ nm.init(conf);
+ nm.start();
+ // Start a container and make sure it is in RUNNING state
+ ((TestNodeManager4) nm).startContainer();
+ // Simulate a container resource increase in a separate thread
+ ((TestNodeManager4) nm).updateContainerResource();
+ // Simulate RM restart by sending a RESYNC event
+ LOG.info("Sending out RESYNC event");
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This is to test when NM gets the resync response from last heart beat, it
// should be able to send the already-sent-via-last-heart-beat container
// statuses again when it re-register with RM.
+ @SuppressWarnings("resource")
@Test
public void testNMSentContainerStatusOnResync() throws Exception {
final ContainerStatus testCompleteContainer =
@@ -323,15 +329,18 @@ public class TestNodeManagerResync {
}
};
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
-
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
+ nm.init(conf);
+ nm.start();
+
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This can be used as a common base class for testing NM resync behavior.
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[4/5] hadoop git commit: YARN-8344. Missing nm.stop() in
TestNodeManagerResync to fix testKillContainersOnResync. Contributed by
Giovanni Matteo Fumarola.
Posted by in...@apache.org.
YARN-8344. Missing nm.stop() in TestNodeManagerResync to fix testKillContainersOnResync. Contributed by Giovanni Matteo Fumarola.
(cherry picked from commit e99e5bf104e9664bc1b43a2639d87355d47a77e2)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8f43ade4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8f43ade4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8f43ade4
Branch: refs/heads/branch-2
Commit: 8f43ade46a05d850cd9c4ccf30fdcb6b45f62165
Parents: c5ff955
Author: Inigo Goiri <in...@apache.org>
Authored: Wed May 23 14:15:26 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Wed May 23 14:17:20 2018 -0700
----------------------------------------------------------------------
.../nodemanager/TestNodeManagerResync.java | 87 +++++++++++---------
1 file changed, 48 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/8f43ade4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
index 97e9922..cf33775 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
@@ -150,7 +150,6 @@ public class TestNodeManagerResync {
testContainerPreservationOnResyncImpl(nm, true);
}
- @SuppressWarnings("unchecked")
protected void testContainerPreservationOnResyncImpl(TestNodeManager1 nm,
boolean isWorkPreservingRestartEnabled)
throws IOException, YarnException, InterruptedException {
@@ -186,32 +185,35 @@ public class TestNodeManagerResync {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=10000)
public void testNMshutdownWhenResyncThrowException() throws IOException,
InterruptedException, YarnException {
NodeManager nm = new TestNodeManager3();
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
- Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
- nm.getNMDispatcher().getEventHandler()
- .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
-
- synchronized (isNMShutdownCalled) {
- while (isNMShutdownCalled.get() == false) {
- try {
- isNMShutdownCalled.wait();
- } catch (InterruptedException e) {
+ try {
+ nm.init(conf);
+ nm.start();
+ Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+
+ synchronized (isNMShutdownCalled) {
+ while (!isNMShutdownCalled.get()) {
+ try {
+ isNMShutdownCalled.wait();
+ } catch (InterruptedException e) {
+ }
}
}
- }
- Assert.assertTrue("NM shutdown not called.",isNMShutdownCalled.get());
- nm.stop();
+ Assert.assertTrue("NM shutdown not called.", isNMShutdownCalled.get());
+ } finally {
+ nm.stop();
+ }
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=60000)
public void testContainerResourceIncreaseIsSynchronizedWithRMResync()
throws IOException, InterruptedException, YarnException {
@@ -219,28 +221,32 @@ public class TestNodeManagerResync {
YarnConfiguration conf = createNMConfig();
conf.setBoolean(
YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, true);
- nm.init(conf);
- nm.start();
- // Start a container and make sure it is in RUNNING state
- ((TestNodeManager4)nm).startContainer();
- // Simulate a container resource increase in a separate thread
- ((TestNodeManager4)nm).updateContainerResource();
- // Simulate RM restart by sending a RESYNC event
- LOG.info("Sending out RESYNC event");
- nm.getNMDispatcher().getEventHandler().handle(
- new NodeManagerEvent(NodeManagerEventType.RESYNC));
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
+ nm.init(conf);
+ nm.start();
+ // Start a container and make sure it is in RUNNING state
+ ((TestNodeManager4) nm).startContainer();
+ // Simulate a container resource increase in a separate thread
+ ((TestNodeManager4) nm).updateContainerResource();
+ // Simulate RM restart by sending a RESYNC event
+ LOG.info("Sending out RESYNC event");
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This is to test when NM gets the resync response from last heart beat, it
// should be able to send the already-sent-via-last-heart-beat container
// statuses again when it re-register with RM.
+ @SuppressWarnings("resource")
@Test
public void testNMSentContainerStatusOnResync() throws Exception {
final ContainerStatus testCompleteContainer =
@@ -323,15 +329,18 @@ public class TestNodeManagerResync {
}
};
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
-
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
+ nm.init(conf);
+ nm.start();
+
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This can be used as a common base class for testing NM resync behavior.
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[2/5] hadoop git commit: YARN-8344. Missing nm.stop() in
TestNodeManagerResync to fix testKillContainersOnResync. Contributed by
Giovanni Matteo Fumarola.
Posted by in...@apache.org.
YARN-8344. Missing nm.stop() in TestNodeManagerResync to fix testKillContainersOnResync. Contributed by Giovanni Matteo Fumarola.
(cherry picked from commit e99e5bf104e9664bc1b43a2639d87355d47a77e2)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/61b5b2f4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/61b5b2f4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/61b5b2f4
Branch: refs/heads/branch-3.1
Commit: 61b5b2f4f7de971f5a18e3af206c86ba116dbfe5
Parents: f57e91a
Author: Inigo Goiri <in...@apache.org>
Authored: Wed May 23 14:15:26 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Wed May 23 14:16:03 2018 -0700
----------------------------------------------------------------------
.../nodemanager/TestNodeManagerResync.java | 87 +++++++++++---------
1 file changed, 48 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/61b5b2f4/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
index 97e9922..cf33775 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
@@ -150,7 +150,6 @@ public class TestNodeManagerResync {
testContainerPreservationOnResyncImpl(nm, true);
}
- @SuppressWarnings("unchecked")
protected void testContainerPreservationOnResyncImpl(TestNodeManager1 nm,
boolean isWorkPreservingRestartEnabled)
throws IOException, YarnException, InterruptedException {
@@ -186,32 +185,35 @@ public class TestNodeManagerResync {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=10000)
public void testNMshutdownWhenResyncThrowException() throws IOException,
InterruptedException, YarnException {
NodeManager nm = new TestNodeManager3();
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
- Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
- nm.getNMDispatcher().getEventHandler()
- .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
-
- synchronized (isNMShutdownCalled) {
- while (isNMShutdownCalled.get() == false) {
- try {
- isNMShutdownCalled.wait();
- } catch (InterruptedException e) {
+ try {
+ nm.init(conf);
+ nm.start();
+ Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+
+ synchronized (isNMShutdownCalled) {
+ while (!isNMShutdownCalled.get()) {
+ try {
+ isNMShutdownCalled.wait();
+ } catch (InterruptedException e) {
+ }
}
}
- }
- Assert.assertTrue("NM shutdown not called.",isNMShutdownCalled.get());
- nm.stop();
+ Assert.assertTrue("NM shutdown not called.", isNMShutdownCalled.get());
+ } finally {
+ nm.stop();
+ }
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=60000)
public void testContainerResourceIncreaseIsSynchronizedWithRMResync()
throws IOException, InterruptedException, YarnException {
@@ -219,28 +221,32 @@ public class TestNodeManagerResync {
YarnConfiguration conf = createNMConfig();
conf.setBoolean(
YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, true);
- nm.init(conf);
- nm.start();
- // Start a container and make sure it is in RUNNING state
- ((TestNodeManager4)nm).startContainer();
- // Simulate a container resource increase in a separate thread
- ((TestNodeManager4)nm).updateContainerResource();
- // Simulate RM restart by sending a RESYNC event
- LOG.info("Sending out RESYNC event");
- nm.getNMDispatcher().getEventHandler().handle(
- new NodeManagerEvent(NodeManagerEventType.RESYNC));
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
+ nm.init(conf);
+ nm.start();
+ // Start a container and make sure it is in RUNNING state
+ ((TestNodeManager4) nm).startContainer();
+ // Simulate a container resource increase in a separate thread
+ ((TestNodeManager4) nm).updateContainerResource();
+ // Simulate RM restart by sending a RESYNC event
+ LOG.info("Sending out RESYNC event");
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This is to test when NM gets the resync response from last heart beat, it
// should be able to send the already-sent-via-last-heart-beat container
// statuses again when it re-register with RM.
+ @SuppressWarnings("resource")
@Test
public void testNMSentContainerStatusOnResync() throws Exception {
final ContainerStatus testCompleteContainer =
@@ -323,15 +329,18 @@ public class TestNodeManagerResync {
}
};
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
-
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
+ nm.init(conf);
+ nm.start();
+
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This can be used as a common base class for testing NM resync behavior.
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[5/5] hadoop git commit: YARN-8344. Missing nm.stop() in
TestNodeManagerResync to fix testKillContainersOnResync. Contributed by
Giovanni Matteo Fumarola.
Posted by in...@apache.org.
YARN-8344. Missing nm.stop() in TestNodeManagerResync to fix testKillContainersOnResync. Contributed by Giovanni Matteo Fumarola.
(cherry picked from commit e99e5bf104e9664bc1b43a2639d87355d47a77e2)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/50347eaf
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/50347eaf
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/50347eaf
Branch: refs/heads/branch-2.9
Commit: 50347eaf5696c8395c83a4d5733a258b4da107a3
Parents: 8347a6c
Author: Inigo Goiri <in...@apache.org>
Authored: Wed May 23 14:15:26 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Wed May 23 14:17:33 2018 -0700
----------------------------------------------------------------------
.../nodemanager/TestNodeManagerResync.java | 87 +++++++++++---------
1 file changed, 48 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/50347eaf/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
index 97e9922..cf33775 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
@@ -150,7 +150,6 @@ public class TestNodeManagerResync {
testContainerPreservationOnResyncImpl(nm, true);
}
- @SuppressWarnings("unchecked")
protected void testContainerPreservationOnResyncImpl(TestNodeManager1 nm,
boolean isWorkPreservingRestartEnabled)
throws IOException, YarnException, InterruptedException {
@@ -186,32 +185,35 @@ public class TestNodeManagerResync {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=10000)
public void testNMshutdownWhenResyncThrowException() throws IOException,
InterruptedException, YarnException {
NodeManager nm = new TestNodeManager3();
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
- Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
- nm.getNMDispatcher().getEventHandler()
- .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
-
- synchronized (isNMShutdownCalled) {
- while (isNMShutdownCalled.get() == false) {
- try {
- isNMShutdownCalled.wait();
- } catch (InterruptedException e) {
+ try {
+ nm.init(conf);
+ nm.start();
+ Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+
+ synchronized (isNMShutdownCalled) {
+ while (!isNMShutdownCalled.get()) {
+ try {
+ isNMShutdownCalled.wait();
+ } catch (InterruptedException e) {
+ }
}
}
- }
- Assert.assertTrue("NM shutdown not called.",isNMShutdownCalled.get());
- nm.stop();
+ Assert.assertTrue("NM shutdown not called.", isNMShutdownCalled.get());
+ } finally {
+ nm.stop();
+ }
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=60000)
public void testContainerResourceIncreaseIsSynchronizedWithRMResync()
throws IOException, InterruptedException, YarnException {
@@ -219,28 +221,32 @@ public class TestNodeManagerResync {
YarnConfiguration conf = createNMConfig();
conf.setBoolean(
YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, true);
- nm.init(conf);
- nm.start();
- // Start a container and make sure it is in RUNNING state
- ((TestNodeManager4)nm).startContainer();
- // Simulate a container resource increase in a separate thread
- ((TestNodeManager4)nm).updateContainerResource();
- // Simulate RM restart by sending a RESYNC event
- LOG.info("Sending out RESYNC event");
- nm.getNMDispatcher().getEventHandler().handle(
- new NodeManagerEvent(NodeManagerEventType.RESYNC));
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
+ nm.init(conf);
+ nm.start();
+ // Start a container and make sure it is in RUNNING state
+ ((TestNodeManager4) nm).startContainer();
+ // Simulate a container resource increase in a separate thread
+ ((TestNodeManager4) nm).updateContainerResource();
+ // Simulate RM restart by sending a RESYNC event
+ LOG.info("Sending out RESYNC event");
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This is to test when NM gets the resync response from last heart beat, it
// should be able to send the already-sent-via-last-heart-beat container
// statuses again when it re-register with RM.
+ @SuppressWarnings("resource")
@Test
public void testNMSentContainerStatusOnResync() throws Exception {
final ContainerStatus testCompleteContainer =
@@ -323,15 +329,18 @@ public class TestNodeManagerResync {
}
};
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
-
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
+ nm.init(conf);
+ nm.start();
+
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This can be used as a common base class for testing NM resync behavior.
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[3/5] hadoop git commit: YARN-8344. Missing nm.stop() in
TestNodeManagerResync to fix testKillContainersOnResync. Contributed by
Giovanni Matteo Fumarola.
Posted by in...@apache.org.
YARN-8344. Missing nm.stop() in TestNodeManagerResync to fix testKillContainersOnResync. Contributed by Giovanni Matteo Fumarola.
(cherry picked from commit e99e5bf104e9664bc1b43a2639d87355d47a77e2)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7c5a5f31
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7c5a5f31
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7c5a5f31
Branch: refs/heads/branch-3.0
Commit: 7c5a5f31dc08c2d8f258832ff87fb7a13afe8f40
Parents: 506f61e
Author: Inigo Goiri <in...@apache.org>
Authored: Wed May 23 14:15:26 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Wed May 23 14:16:37 2018 -0700
----------------------------------------------------------------------
.../nodemanager/TestNodeManagerResync.java | 87 +++++++++++---------
1 file changed, 48 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7c5a5f31/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
index 97e9922..cf33775 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeManagerResync.java
@@ -150,7 +150,6 @@ public class TestNodeManagerResync {
testContainerPreservationOnResyncImpl(nm, true);
}
- @SuppressWarnings("unchecked")
protected void testContainerPreservationOnResyncImpl(TestNodeManager1 nm,
boolean isWorkPreservingRestartEnabled)
throws IOException, YarnException, InterruptedException {
@@ -186,32 +185,35 @@ public class TestNodeManagerResync {
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=10000)
public void testNMshutdownWhenResyncThrowException() throws IOException,
InterruptedException, YarnException {
NodeManager nm = new TestNodeManager3();
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
- Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
- nm.getNMDispatcher().getEventHandler()
- .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
-
- synchronized (isNMShutdownCalled) {
- while (isNMShutdownCalled.get() == false) {
- try {
- isNMShutdownCalled.wait();
- } catch (InterruptedException e) {
+ try {
+ nm.init(conf);
+ nm.start();
+ Assert.assertEquals(1, ((TestNodeManager3) nm).getNMRegistrationCount());
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+
+ synchronized (isNMShutdownCalled) {
+ while (!isNMShutdownCalled.get()) {
+ try {
+ isNMShutdownCalled.wait();
+ } catch (InterruptedException e) {
+ }
}
}
- }
- Assert.assertTrue("NM shutdown not called.",isNMShutdownCalled.get());
- nm.stop();
+ Assert.assertTrue("NM shutdown not called.", isNMShutdownCalled.get());
+ } finally {
+ nm.stop();
+ }
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("resource")
@Test(timeout=60000)
public void testContainerResourceIncreaseIsSynchronizedWithRMResync()
throws IOException, InterruptedException, YarnException {
@@ -219,28 +221,32 @@ public class TestNodeManagerResync {
YarnConfiguration conf = createNMConfig();
conf.setBoolean(
YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_ENABLED, true);
- nm.init(conf);
- nm.start();
- // Start a container and make sure it is in RUNNING state
- ((TestNodeManager4)nm).startContainer();
- // Simulate a container resource increase in a separate thread
- ((TestNodeManager4)nm).updateContainerResource();
- // Simulate RM restart by sending a RESYNC event
- LOG.info("Sending out RESYNC event");
- nm.getNMDispatcher().getEventHandler().handle(
- new NodeManagerEvent(NodeManagerEventType.RESYNC));
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
+ nm.init(conf);
+ nm.start();
+ // Start a container and make sure it is in RUNNING state
+ ((TestNodeManager4) nm).startContainer();
+ // Simulate a container resource increase in a separate thread
+ ((TestNodeManager4) nm).updateContainerResource();
+ // Simulate RM restart by sending a RESYNC event
+ LOG.info("Sending out RESYNC event");
+ nm.getNMDispatcher().getEventHandler()
+ .handle(new NodeManagerEvent(NodeManagerEventType.RESYNC));
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This is to test when NM gets the resync response from last heart beat, it
// should be able to send the already-sent-via-last-heart-beat container
// statuses again when it re-register with RM.
+ @SuppressWarnings("resource")
@Test
public void testNMSentContainerStatusOnResync() throws Exception {
final ContainerStatus testCompleteContainer =
@@ -323,15 +329,18 @@ public class TestNodeManagerResync {
}
};
YarnConfiguration conf = createNMConfig();
- nm.init(conf);
- nm.start();
-
try {
- syncBarrier.await();
- } catch (BrokenBarrierException e) {
+ nm.init(conf);
+ nm.start();
+
+ try {
+ syncBarrier.await();
+ } catch (BrokenBarrierException e) {
+ }
+ Assert.assertFalse(assertionFailedInThread.get());
+ } finally {
+ nm.stop();
}
- Assert.assertFalse(assertionFailedInThread.get());
- nm.stop();
}
// This can be used as a common base class for testing NM resync behavior.
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org