hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [5/6] hadoop git commit: HDFS-12832. INode.getFullPathName may throw ArrayIndexOutOfBoundsException lead to NameNode exit. Contribuited by Konstantin Shvachko.
Date Wed, 29 Nov 2017 02:18:29 GMT
HDFS-12832. INode.getFullPathName may throw ArrayIndexOutOfBoundsException lead to NameNode
exit. Contribuited by Konstantin Shvachko.

(cherry picked from commit d331762f24b3f22f609366740c9c4f449edc61ac)

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

Branch: refs/heads/branch-2.7
Commit: 7252e18c30f40bce9d01d5bb77f0ae526f479ad4
Parents: 0da13b9
Author: Konstantin V Shvachko <shv@apache.org>
Authored: Tue Nov 28 17:14:23 2017 -0800
Committer: Konstantin V Shvachko <shv@apache.org>
Committed: Tue Nov 28 18:07:39 2017 -0800

----------------------------------------------------------------------
 .../server/blockmanagement/BlockManager.java    | 28 +++++++++++---------
 1 file changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/7252e18c/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
index da15397..57fda98 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
@@ -95,7 +95,6 @@ import org.apache.hadoop.util.Time;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -1475,8 +1474,6 @@ public class BlockManager {
       }
 
       // choose replication targets: NOT HOLDING THE GLOBAL LOCK
-      // It is costly to extract the filename for which chooseTargets is called,
-      // so for now we pass in the block collection itself.
       rw.chooseTargets(blockplacement, storagePolicySuite, excludedNodes);
     }
 
@@ -3708,17 +3705,15 @@ public class BlockManager {
   
 
   private static class ReplicationWork {
-
     private final Block block;
-    private final BlockCollection bc;
-
+    private final String srcPath;
+    private final byte storagePolicyID;
     private final DatanodeDescriptor srcNode;
+    private final int additionalReplRequired;
+    private final int priority;
     private final List<DatanodeDescriptor> containingNodes;
     private final List<DatanodeStorageInfo> liveReplicaStorages;
-    private final int additionalReplRequired;
-
     private DatanodeStorageInfo targets[];
-    private final int priority;
 
     public ReplicationWork(Block block,
         BlockCollection bc,
@@ -3728,7 +3723,8 @@ public class BlockManager {
         int additionalReplRequired,
         int priority) {
       this.block = block;
-      this.bc = bc;
+      this.srcPath = bc.getName();
+      this.storagePolicyID = bc.getStoragePolicyID();
       this.srcNode = srcNode;
       this.srcNode.incrementPendingReplicationWithoutTargets();
       this.containingNodes = containingNodes;
@@ -3742,14 +3738,22 @@ public class BlockManager {
         BlockStoragePolicySuite storagePolicySuite,
         Set<Node> excludedNodes) {
       try {
-        targets = blockplacement.chooseTarget(bc.getName(),
+        targets = blockplacement.chooseTarget(getSrcPath(),
             additionalReplRequired, srcNode, liveReplicaStorages, false,
             excludedNodes, block.getNumBytes(),
-            storagePolicySuite.getPolicy(bc.getStoragePolicyID()));
+            storagePolicySuite.getPolicy(getStoragePolicyID()));
       } finally {
         srcNode.decrementPendingReplicationWithoutTargets();
       }
     }
+
+    private String getSrcPath() {
+      return srcPath;
+    }
+
+    private byte getStoragePolicyID() {
+      return storagePolicyID;
+    }
   }
 
   /**


---------------------------------------------------------------------
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