diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java index 7d5d73c9a4..1131506b6b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java @@ -1542,7 +1542,7 @@ private void setDatanodeDead(DatanodeDescriptor node) { } private BlockRecoveryCommand getBlockRecoveryCommand(String blockPoolId, - DatanodeDescriptor nodeinfo) { + DatanodeDescriptor nodeinfo) throws IOException { BlockInfo[] blocks = nodeinfo.getLeaseRecoveryCommand(Integer.MAX_VALUE); if (blocks == null) { return null; @@ -1550,7 +1550,10 @@ private BlockRecoveryCommand getBlockRecoveryCommand(String blockPoolId, BlockRecoveryCommand brCommand = new BlockRecoveryCommand(blocks.length); for (BlockInfo b : blocks) { BlockUnderConstructionFeature uc = b.getUnderConstructionFeature(); - assert uc != null; + if(uc == null) { + throw new IOException("Recovery block " + b + + "where it is not under construction."); + } final DatanodeStorageInfo[] storages = uc.getExpectedStorageLocations(); // Skip stale nodes during recovery final List recoveryLocations =