ivandika3 commented on code in PR #9926:
URL: https://github.com/apache/ozone/pull/9926#discussion_r2945848694
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DeadNodeHandler.java:
##########
@@ -119,15 +119,24 @@ public void onMessage(final DatanodeDetails
datanodeDetails,
deletedBlockLog.onDatanodeDead(datanodeDetails.getID());
}
- //move dead datanode out of ClusterNetworkTopology
- NetworkTopology nt = nodeManager.getClusterNetworkTopologyMap();
- if (nt.contains(datanodeDetails)) {
- nt.remove(datanodeDetails);
- //make sure after DN is removed from topology,
- //DatanodeDetails instance returned from nodeStateManager has no
parent.
- Preconditions.checkState(
- nodeManager.getNode(datanodeDetails.getID())
- .getParent() == null);
+ // Only remove from topology if the node is still DEAD. Between the time
+ // the DEAD_NODE event was fired and now, the node may have been
+ // resurrected (DEAD -> HEALTHY_READONLY) via a heartbeat. Removing a
+ // resurrected node from the topology would leave it reachable but
+ // invisible to the placement policy.
+ NodeStatus currentStatus =
+ nodeManager.getNodeStatus(datanodeDetails);
+ if (currentStatus.getHealth() == HddsProtos.NodeState.DEAD) {
+ NetworkTopology nt = nodeManager.getClusterNetworkTopologyMap();
+ if (nt.contains(datanodeDetails)) {
+ nt.remove(datanodeDetails);
+ Preconditions.checkState(
Review Comment:
Thanks, should not be introduced in this patch, but updated to prevent null.
Anyway, since `SingleThreadExecutor#onEvent` catches all exception, it
should not cause event handler thread termination.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]