From fccacfb212533f8f7b7a50fe58a5206d6950212c Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Mon, 23 Jun 2014 21:31:24 +0000 Subject: [PATCH] HDFS-6578: Merging r1604942 from trunk to branch-2. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1604943 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 1 + .../hadoop/hdfs/server/namenode/NameNodeRpcServer.java | 5 +++++ .../apache/hadoop/hdfs/server/protocol/DatanodeStorage.java | 5 +++++ 4 files changed, 14 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index a382402f21c..5a7acb477b5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -210,6 +210,9 @@ Release 2.5.0 - UNRELEASED HDFS-6507. Improve DFSAdmin to support HA cluster better. (Zesheng Wu via vinayakumarb) + HDFS-6578. add toString method to DatanodeStorage for easier debugging. + (Yongjun Zhang via Arpit Agarwal) + OPTIMIZATIONS HDFS-6214. Webhdfs has poor throughput for files >2GB (daryn) 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 04b02e3f7cd..e8cb09e707a 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 @@ -1752,6 +1752,7 @@ public class BlockManager { } blockLog.info("BLOCK* processReport: from storage " + storage.getStorageID() + " node " + nodeID + ", blocks: " + newReport.getNumberOfBlocks() + + ", hasStaleStorages: " + node.hasStaleStorages() + ", processing time: " + (endTime - startTime) + " msecs"); return !node.hasStaleStorages(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java index 2461c6ce3e9..c29e059f4fb 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java @@ -1041,6 +1041,11 @@ class NameNodeRpcServer implements NamenodeProtocols { boolean noStaleStorages = false; for(StorageBlockReport r : reports) { final BlockListAsLongs blocks = new BlockListAsLongs(r.getBlocks()); + // + // BlockManager.processReport accumulates information of prior calls + // for the same node and storage, so the value returned by the last + // call of this loop is the final updated value for noStaleStorage. + // noStaleStorages = bm.processReport(nodeReg, r.getStorage(), poolId, blocks); metrics.incrStorageBlockReportOps(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeStorage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeStorage.java index a1c048c8525..63303ebf1f1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeStorage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeStorage.java @@ -81,6 +81,11 @@ public class DatanodeStorage { return "DS-" + UUID.randomUUID(); } + @Override + public String toString() { + return "DatanodeStorage["+ storageID + "," + storageType + "," + state +"]"; + } + @Override public boolean equals(Object other){ if (other == this) {