HDFS-11890. Handle NPE in BlockRecoveryWorker when DN is getting shoutdown. Contributed by Surendra Singh Lilhore.
This commit is contained in:
parent
d954a64730
commit
099cbb427a
@ -127,8 +127,7 @@ protected void recover() throws IOException {
|
||||
// - Original state is RWR or better
|
||||
for(DatanodeID id : locs) {
|
||||
try {
|
||||
DatanodeID bpReg = new DatanodeID(
|
||||
datanode.getBPOfferService(bpid).bpRegistration);
|
||||
DatanodeID bpReg = getDatanodeID(bpid);
|
||||
InterDatanodeProtocol proxyDN = bpReg.equals(id)?
|
||||
datanode: DataNode.createInterDataNodeProtocolProxy(id, conf,
|
||||
dnConf.socketTimeout, dnConf.connectToDnViaHostname);
|
||||
@ -398,8 +397,7 @@ protected void recover() throws IOException {
|
||||
for (int i = 0; i < locs.length; i++) {
|
||||
DatanodeID id = locs[i];
|
||||
try {
|
||||
DatanodeID bpReg = new DatanodeID(
|
||||
datanode.getBPOfferService(bpid).bpRegistration);
|
||||
DatanodeID bpReg = getDatanodeID(bpid);
|
||||
InterDatanodeProtocol proxyDN = bpReg.equals(id) ?
|
||||
datanode : DataNode.createInterDataNodeProtocolProxy(id, conf,
|
||||
dnConf.socketTimeout, dnConf.connectToDnViaHostname);
|
||||
@ -532,6 +530,14 @@ private void checkLocations(int locationCount)
|
||||
}
|
||||
}
|
||||
|
||||
private DatanodeID getDatanodeID(String bpid) throws IOException {
|
||||
BPOfferService bpos = datanode.getBPOfferService(bpid);
|
||||
if (bpos == null) {
|
||||
throw new IOException("No block pool offer service for bpid=" + bpid);
|
||||
}
|
||||
return new DatanodeID(bpos.bpRegistration);
|
||||
}
|
||||
|
||||
private static void logRecoverBlock(String who, RecoveringBlock rb) {
|
||||
ExtendedBlock block = rb.getBlock();
|
||||
DatanodeInfo[] targets = rb.getLocations();
|
||||
|
Loading…
Reference in New Issue
Block a user