You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/07/29 02:36:56 UTC

[GitHub] [ozone] JacksonYao287 commented on a change in pull request #2435: HDDS-5437. Move dead DN out of topology

JacksonYao287 commented on a change in pull request #2435:
URL: https://github.com/apache/ozone/pull/2435#discussion_r678779462



##########
File path: hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java
##########
@@ -212,6 +208,7 @@ public void testOnMessage() throws Exception {
 
     // First set the node to IN_MAINTENANCE and ensure the container replicas
     // are not removed on the dead event
+    datanode1 = nodeManager.getNodeByUuid(datanode1.getUuidString());

Review comment:
       thanks @sodonnel  for the review!
   
   >How does this change test this feature?
   ```
         for(DatanodeInfo node : nodeStateMap.getAllDatanodeInfos()) {
                 .....
           case STALE:
             // Move the node to DEAD if the last heartbeat time is less than
             // configured dead-node interval.
             updateNodeState(node, deadNodeCondition, status,
                 NodeLifeCycleEvent.TIMEOUT);
                ......
         }
   ```
   this is the current code in `NodeStateManager`, and it is the only place where a `DEAD` event is fired and `DeadNodeHandler` is called. So we can see here when judging the state of all the nodes , we get all the DatanodeInfos from `nodeStateMap` directly. when a datonode registers itself to scm, it will be added to `nodeStateMap`. but let us see `nodeStateMap#add`.
   ```
     public void addNode(......)
          ...........
         nodeMap.put(id, new DatanodeInfo(datanodeDetails, nodeStatus,
             layoutInfo));
          ............
     }
   ```
   we can see that a new object is created here and added to the map, so the registered `DatanodeDetails` is not the one which is stored is `nodeMap` and got by `DeadNodeHandler` when `DEAD` event is fired . so  i think the current test code does not notice this , and this is why the change here is made.
   
   >I think we need a test (or extend this test) to ensure the node is removed from the topology when the dead handler is called and another test to ensure it is put back when the healthy event is fired.
   
   yea ,  although i have add a ` Preconditions.checkState` in the handlers , i think it`s better off adding this . i will do it
   




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org