Browse Source

HDDS-449. Add a NULL check to protect DeadNodeHandler#onMessage. Contributed by LiXin Ge.

Márton Elek 6 years ago
parent
commit
a65c3ea91c

+ 5 - 0
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java

@@ -57,6 +57,11 @@ public class DeadNodeHandler implements EventHandler<DatanodeDetails> {
       EventPublisher publisher) {
     Set<ContainerID> containers =
         node2ContainerMap.getContainers(datanodeDetails.getUuid());
+    if (containers == null) {
+      LOG.info("There's no containers in dead datanode {}, no replica will be"
+          + " removed from the in-memory state.", datanodeDetails.getUuid());
+      return;
+    }
     LOG.info(
         "Datanode {}  is dead. Removing replications from the in-memory state.",
         datanodeDetails.getUuid());