Details
Description
When i read the scan() of DirectoryScanner class in datanode, i found the following condition code could be more simplify and easy to understand.
DirectoryScanner.java
if (d < blockpoolReport.length) { // There may be multiple on-disk records for the same block, don't increment // the memory record pointer if so. ScanInfo nextInfo = blockpoolReport[Math.min(d, blockpoolReport.length - 1)]; if (nextInfo.getBlockId() != info.getBlockId()) { ++m; } } else { ++m; }
as described above code segmet, i find the code of d < blockpoolReport.length and the max of d is blockpoolReport.length-1, so that result of Math.min(d, blockpoolReport.length - 1) always is d, so i think needn't to get min value of scan index and length for blockpoolReport.
thanks!