Browse Source

HDFS-13829. Remove redundant condition judgement in DirectoryScanner#scan. Contributed by liaoyuxiangqin.

Yiqun Lin 6 years ago
parent
commit
6df606f1b4

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java

@@ -450,7 +450,7 @@ public class DirectoryScanner implements Runnable {
           if (d < blockpoolReport.length) {
           if (d < blockpoolReport.length) {
             // There may be multiple on-disk records for the same block, don't increment
             // There may be multiple on-disk records for the same block, don't increment
             // the memory record pointer if so.
             // the memory record pointer if so.
-            ScanInfo nextInfo = blockpoolReport[Math.min(d, blockpoolReport.length - 1)];
+            ScanInfo nextInfo = blockpoolReport[d];
             if (nextInfo.getBlockId() != info.getBlockId()) {
             if (nextInfo.getBlockId() != info.getBlockId()) {
               ++m;
               ++m;
             }
             }