Copilot commented on code in PR #11343:
URL: https://github.com/apache/ozone/pull/11343#discussion_r4118041315


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/NodeStateManager.java:
##########
@@ -958,6 +967,26 @@ private void updateNodeState(DatanodeInfo node, 
Predicate<Long> condition,
     }
   }
 
+  /**
+   * Removes the node from the network topology when it becomes DEAD, and adds 
it back when it recovers.
+   * Doing it here, not in event handlers, keeps the topology in step with the 
node's health.
+   */
+  private void updateClusterMap(DatanodeInfo node, NodeStatus oldStatus, 
NodeStatus newStatus) {
+    try {
+      if (newStatus.isDead()) {
+        if (clusterMap.contains(node)) {
+          clusterMap.remove(node);
+        }

Review Comment:
   `NetworkTopology.contains` determines membership from the node's parent 
pointer, but `NodeStateManager.updateNode` replaces a `DatanodeInfo` with a 
fresh copy on version/port-only registration updates (`SCMNodeManager` lines 
486-495), whose parent is null while the old instance remains in the topology. 
In that case this check returns false and the DEAD transition leaves the old 
topology entry in place. Reconcile/remove the topology's node instance (for 
example by looking it up by `getNetworkFullPath()`) rather than checking the 
state-map instance's parent.
   
   This issue also appears on line 983 of the same file.



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