diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java index e4861f9774..249888c464 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java @@ -468,9 +468,9 @@ protected void recover() throws IOException { // notify Namenode the new size and locations final DatanodeID[] newLocs = new DatanodeID[totalBlkNum]; final String[] newStorages = new String[totalBlkNum]; - for (int i = 0; i < blockIndices.length; i++) { - newLocs[blockIndices[i]] = DatanodeID.EMPTY_DATANODE_ID; - newStorages[blockIndices[i]] = ""; + for (int i = 0; i < newLocs.length; i++) { + newLocs[i] = DatanodeID.EMPTY_DATANODE_ID; + newStorages[i] = ""; } for (BlockRecord r : rurList) { int index = (int) (r.rInfo.getBlockId() &