adoroszlai opened a new pull request, #5588:
URL: https://github.com/apache/ozone/pull/5588

   ## What changes were proposed in this pull request?
   
   When datanode registers, SCM adds the `DatanodeDetails` object to:
    * `NetworkTopologyImpl`, which sets `level` in `DatanodeDetails`
    * `NodeStateMap` (via `NodeStateManager`), which copies it as a 
`DatanodeInfo` object (`extends DatanodeDetails`)
   
   The problem is that `level` is lost during this copy.  These `DatanodeInfo` 
objects are retrieved from `NodeStateMap` and passed to `NetworkTopologyImpl` 
by `sortDatanodes`.  Since all datanodes have the same level, distance 
calculation still works, but this is accidental.  Searching for a `Node` object 
that has the proper level set would yield wrong results.
   
   This change ensures `level` is copied to the wrapper `DatanodeInfo`.
   
   https://issues.apache.org/jira/browse/HDDS-9678
   
   ## How was this patch tested?
   
   Added unit test case to verify datanodes assigned to two racks are sorted 
properly.
   
   CI:
   https://github.com/adoroszlai/ozone/actions/runs/6842484613


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