hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inigo...@apache.org
Subject [26/50] [abbrv] hadoop git commit: HDFS-11890. Handle NPE in BlockRecoveryWorker when DN is getting shoutdown. Contributed by Surendra Singh Lilhore.
Date Wed, 21 Jun 2017 23:24:13 GMT
HDFS-11890. Handle NPE in BlockRecoveryWorker when DN is getting shoutdown. Contributed by
Surendra Singh Lilhore.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/099cbb42
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/099cbb42
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/099cbb42

Branch: refs/heads/HDFS-10467
Commit: 099cbb427ad535c3369d9ac3fda6463502fc1c54
Parents: d954a64
Author: Brahma Reddy Battula <brahma@apache.org>
Authored: Tue Jun 20 11:03:56 2017 +0800
Committer: Brahma Reddy Battula <brahma@apache.org>
Committed: Tue Jun 20 11:03:56 2017 +0800

----------------------------------------------------------------------
 .../hdfs/server/datanode/BlockRecoveryWorker.java     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/099cbb42/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java
----------------------------------------------------------------------
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 792b6af..15c4af1 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
@@ -127,8 +127,7 @@ public class BlockRecoveryWorker {
       // - 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 @@ public class BlockRecoveryWorker {
       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 @@ public class BlockRecoveryWorker {
     }
   }
 
+  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();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message