[ https://issues.apache.org/jira/browse/HDFS-15574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephen O'Donnell updated HDFS-15574: ------------------------------------- Attachment: HDFS-15574.001.patch > 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 > > > 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: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org