hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject hadoop git commit: HDDS-557. DeadNodeHandler should handle exception from removeContainerHandler api. Contributed by Ajay Kumar.
Date Mon, 01 Oct 2018 18:21:39 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk f7ff8c051 -> cc80ac231


HDDS-557. DeadNodeHandler should handle exception from removeContainerHandler api. Contributed
by Ajay Kumar.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/cc80ac23
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/cc80ac23
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/cc80ac23

Branch: refs/heads/trunk
Commit: cc80ac23156e1e91c1f77df65fa53504fbb34141
Parents: f7ff8c0
Author: Ajay Kumar <ajay@apache.com>
Authored: Mon Oct 1 11:21:26 2018 -0700
Committer: Ajay Kumar <ajay@apache.com>
Committed: Mon Oct 1 11:21:26 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hdds/scm/node/DeadNodeHandler.java   | 16 ++++++++++++--
 .../hdds/scm/node/TestDeadNodeHandler.java      | 23 ++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc80ac23/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java
index 88f5df7..253b3ec 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java
@@ -72,8 +72,13 @@ public class DeadNodeHandler implements EventHandler<DatanodeDetails>
{
         datanodeDetails.getUuid());
     for (ContainerID container : containers) {
       try {
-        containerStateManager.removeContainerReplica(container,
-            datanodeDetails);
+        try {
+          containerStateManager.removeContainerReplica(container,
+              datanodeDetails);
+        } catch (SCMException ex) {
+          LOG.info("DataNode {} doesn't have replica for container {}.",
+              datanodeDetails.getUuid(), container.getId());
+        }
 
         if (!containerStateManager.isOpen(container)) {
           ReplicationRequest replicationRequest =
@@ -90,4 +95,11 @@ public class DeadNodeHandler implements EventHandler<DatanodeDetails>
{
       }
     }
   }
+
+  /**
+   * Returns logger.
+   * */
+  public static Logger getLogger() {
+    return LOG;
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cc80ac23/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java
index 698332e..6966322 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java
@@ -196,6 +196,29 @@ public class TestDeadNodeHandler {
     Assert.assertTrue(nodeStat.get().getScmUsed().get() == 0);
   }
 
+  @Test
+  public void testOnMessageReplicaFailure() throws Exception {
+    DatanodeDetails dn1 = TestUtils.randomDatanodeDetails();
+    GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer
+        .captureLogs(DeadNodeHandler.getLogger());
+    String storagePath1 = GenericTestUtils.getRandomizedTempPath()
+        .concat("/" + dn1.getUuidString());
+
+    StorageReportProto storageOne = TestUtils.createStorageReport(
+        dn1.getUuid(), storagePath1, 100, 10, 90, null);
+    nodeReportHandler.onMessage(getNodeReport(dn1, storageOne),
+        Mockito.mock(EventPublisher.class));
+
+    ContainerInfo container1 =
+        TestUtils.allocateContainer(containerStateManager);
+    registerReplicas(node2ContainerMap, dn1, container1);
+
+    deadNodeHandler.onMessage(dn1, eventQueue);
+    Assert.assertTrue(logCapturer.getOutput().contains(
+        "DataNode " + dn1.getUuid() + " doesn't have replica for container "
+            + container1.getContainerID()));
+  }
+
   private void registerReplicas(ContainerStateManager csm,
       ContainerInfo container, DatanodeDetails... datanodes) {
     csm.getContainerStateMap()


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message