HDFS-5890. Avoid NPE in Datanode heartbeat. Contributed by Vinay
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-5535@1565023 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
35e59eeaa2
commit
b2ce764093
|
@ -20,3 +20,5 @@ HDFS-5535 subtasks:
|
||||||
DataNodeLayoutVersion. (Brandon Li via szetszwo)
|
DataNodeLayoutVersion. (Brandon Li via szetszwo)
|
||||||
|
|
||||||
HDFS-5848. Add rolling upgrade status to heartbeat response. (szetszwo)
|
HDFS-5848. Add rolling upgrade status to heartbeat response. (szetszwo)
|
||||||
|
|
||||||
|
HDFS-5890. Avoid NPE in Datanode heartbeat. (Vinay via brandonli)
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.hadoop.hdfs.protocol.DatanodeID;
|
||||||
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
|
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
|
||||||
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||||
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
||||||
|
import org.apache.hadoop.hdfs.protocol.RollingUpgradeStatus;
|
||||||
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReceivedAndDeletedRequestProto;
|
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReceivedAndDeletedRequestProto;
|
||||||
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReportRequestProto;
|
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReportRequestProto;
|
||||||
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReportResponseProto;
|
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReportResponseProto;
|
||||||
|
@ -183,9 +184,12 @@ public class DatanodeProtocolClientSideTranslatorPB implements
|
||||||
cmds[index] = PBHelper.convert(p);
|
cmds[index] = PBHelper.convert(p);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
return new HeartbeatResponse(cmds,
|
RollingUpgradeStatus rollingUpdateStatus = null;
|
||||||
PBHelper.convert(resp.getHaStatus()),
|
if (resp.hasRollingUpgradeStatus()) {
|
||||||
PBHelper.convert(resp.getRollingUpgradeStatus()));
|
rollingUpdateStatus = PBHelper.convert(resp.getRollingUpgradeStatus());
|
||||||
|
}
|
||||||
|
return new HeartbeatResponse(cmds, PBHelper.convert(resp.getHaStatus()),
|
||||||
|
rollingUpdateStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.hadoop.hdfs.protocol.DatanodeID;
|
import org.apache.hadoop.hdfs.protocol.DatanodeID;
|
||||||
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
||||||
|
import org.apache.hadoop.hdfs.protocol.RollingUpgradeStatus;
|
||||||
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReceivedAndDeletedRequestProto;
|
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReceivedAndDeletedRequestProto;
|
||||||
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReceivedAndDeletedResponseProto;
|
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReceivedAndDeletedResponseProto;
|
||||||
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReportRequestProto;
|
import org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos.BlockReportRequestProto;
|
||||||
|
@ -121,8 +122,12 @@ public class DatanodeProtocolServerSideTranslatorPB implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.setHaStatus(PBHelper.convert(response.getNameNodeHaState()));
|
builder.setHaStatus(PBHelper.convert(response.getNameNodeHaState()));
|
||||||
builder.setRollingUpgradeStatus(PBHelper.convertRollingUpgradeStatus(
|
RollingUpgradeStatus rollingUpdateStatus = response
|
||||||
response.getRollingUpdateStatus()));
|
.getRollingUpdateStatus();
|
||||||
|
if (rollingUpdateStatus != null) {
|
||||||
|
builder.setRollingUpgradeStatus(PBHelper
|
||||||
|
.convertRollingUpgradeStatus(rollingUpdateStatus));
|
||||||
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue