HDFS-13758. DatanodeManager should throw exception if it has BlockRecoveryCommand but the block is not under construction. Contributed by chencan.

This commit is contained in:
Wei-Chiu Chuang 2018-08-14 11:51:27 -07:00
parent 4cba0741d5
commit 61a9b4f58b
1 changed files with 5 additions and 2 deletions

View File

@ -1542,7 +1542,7 @@ public class DatanodeManager {
}
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 @@ public class DatanodeManager {
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<DatanodeStorageInfo> recoveryLocations =