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

Stephen O'Donnell commented on HDFS-15574:
------------------------------------------

[~hemanthboyina] I am not sure what sort of test you would like - can you 
explain more? This patch does not change any logic in the read or write path. 
The method to retrieve all blocks has only been renamed and the output of that 
method was already sorted. Even in the directory scanner no logic has really 
changed - it takes a snapshot of the blocks at the start and we just avoid 
sorting them.

[~liuml07] Sure - I will run the test locally and fix the javadoc - I missed 
that, thanks for spotting it.

> Remove unnecessary sort of block list in DirectoryScanner
> ---------------------------------------------------------
>
>                 Key: HDFS-15574
>                 URL: https://issues.apache.org/jira/browse/HDFS-15574
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 3.4.0
>            Reporter: Stephen O'Donnell
>            Assignee: Stephen O'Donnell
>            Priority: Major
>         Attachments: HDFS-15574.001.patch, HDFS-15574.002.patch
>
>
> These lines of code in DirectoryScanner#scan(), obtain a snapshot of the 
> finalized blocks from memory, and then sort them, under the DN lock. However 
> the blocks are stored in a sorted structure (FoldedTreeSet) and hence the 
> sort should be unnecessary.
> {code}
>   final List<ReplicaInfo> bl = dataset.getFinalizedBlocks(bpid);
>   Collections.sort(bl); // Sort based on blockId
> {code}
> This Jira removes the sort, and renames the getFinalizedBlocks to 
> getSortedFinalizedBlocks to make the intent of the method more clear.
> Also added a test, just in case the underlying block structure is ever 
> changed to something unsorted.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to