[ 
https://issues.apache.org/jira/browse/HDFS-17123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17747363#comment-17747363
 ] 

ASF GitHub Bot commented on HDFS-17123:
---------------------------------------

hfutatzhanghb opened a new pull request, #5891:
URL: https://github.com/apache/hadoop/pull/5891

   ### Description of PR
   Currently in method blockReport(), it uses below code snippets to generate 
per datanode storage blocks:
   
   ```java
       for (Map.Entry<DatanodeStorage, BlockListAsLongs> kvPair : 
perVolumeBlockLists.entrySet()) {
         BlockListAsLongs blockList = kvPair.getValue();
         reports[i++] = new StorageBlockReport(kvPair.getKey(), blockList);
         totalBlockCount += blockList.getNumberOfBlocks();
       }
   ```
   But the `perVolumeBlockLists` is a HashMap object, invocation of its 
entrySet() method will return an unordered Set.
   Here we'd better sort datanodeStorages. By doing this, NameNode will handle 
block report storage by storage in a fixed order. Another advantage is that we 
perhaps use this order in datanode logic in the future.
   
   ### How to test
   existing unit tests about block reports can test this modification. 
   




> Sort datanodeStorages when generating StorageBlockReport[] in method 
> BPServiceActor#blockReport for future convenience
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-17123
>                 URL: https://issues.apache.org/jira/browse/HDFS-17123
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>    Affects Versions: 3.4.0
>            Reporter: farmmamba
>            Assignee: farmmamba
>            Priority: Major
>              Labels: pull-request-available
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to