diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java index 39665e3e95..10951e927f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java @@ -450,7 +450,7 @@ private void scan() { 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)]; + ScanInfo nextInfo = blockpoolReport[d]; if (nextInfo.getBlockId() != info.getBlockId()) { ++m; }