Details
Description
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.
final List<ReplicaInfo> bl = dataset.getFinalizedBlocks(bpid); Collections.sort(bl); // Sort based on blockId
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.
Attachments
Attachments
Issue Links
- relates to
-
HDFS-13671 Namenode deletes large dir slowly caused by FoldedTreeSet#removeAndGet
- Resolved