ivandika3 commented on code in PR #9926:
URL: https://github.com/apache/ozone/pull/9926#discussion_r2945860667


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/HealthyReadOnlyNodeHandler.java:
##########
@@ -96,15 +96,14 @@ public void onMessage(DatanodeDetails datanodeDetails,
       }
     }
 
-    //add node back if it is not present in networkTopology
+    // Always ensure the node is in the topology. Using unconditional add
+    // rather than a contains-then-add check to avoid a race with
+    // DeadNodeHandler, which may remove the node between the check and
+    // the add. InnerNodeImpl.add() is idempotent for existing nodes.
     NetworkTopology nt = nodeManager.getClusterNetworkTopologyMap();
-    if (!nt.contains(datanodeDetails)) {
-      nt.add(datanodeDetails);
-      // make sure after DN is added back into topology, DatanodeDetails
-      // instance returned from nodeStateManager has parent correctly set.
-      Objects.requireNonNull(
-          nodeManager.getNode(datanodeDetails.getID())
-              .getParent(), "Parent == null");
-    }
+    nt.add(datanodeDetails);
+    Objects.requireNonNull(

Review Comment:
   Objects.requireNonNull will throw NPE, I standardized with `DeadNodeHandler`/



-- 
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]

Reply via email to