hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject hadoop git commit: HDFS-10694. processReport() should print blockReportId in each log message. Contributed by Yuanbo Liu.
Date Wed, 10 Aug 2016 18:16:11 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 f5754fe5b -> e88546596


HDFS-10694. processReport() should print blockReportId in each log message. Contributed by
Yuanbo Liu.

(cherry picked from commit 6dfa4fb16e449a248f2f3cf43a6be59dd8e1ac78)


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

Branch: refs/heads/branch-2.7
Commit: e88546596d04730145bf09262e53157a451fc18a
Parents: f5754fe
Author: Yuanbo Liu <liuyuanbo92@gmail.com>
Authored: Wed Aug 10 10:48:42 2016 -0700
Committer: Konstantin V Shvachko <shv@apache.org>
Committed: Wed Aug 10 11:14:33 2016 -0700

----------------------------------------------------------------------
 .../server/blockmanagement/BlockManager.java    | 37 +++++++++++++-------
 1 file changed, 24 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e8854659/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 984fef6..8f37bc6 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
@@ -1807,6 +1807,8 @@ public class BlockManager {
     final long endTime;
     DatanodeDescriptor node;
     Collection<Block> invalidatedBlocks = null;
+    String strBlockReportId =
+        context != null ? Long.toHexString(context.getReportId()) : "";
 
     try {
       node = datanodeManager.getDatanode(nodeID);
@@ -1825,9 +1827,10 @@ public class BlockManager {
       }
       if (namesystem.isInStartupSafeMode()
           && storageInfo.getBlockReportCount() > 0) {
-        blockLog.info("BLOCK* processReport: "
-            + "discarded non-initial block report from {}"
-            + " because namenode still in startup phase", nodeID);
+        blockLog.info("BLOCK* processReport 0x{}: "
+                + "discarded non-initial block report from {}"
+                + " because namenode still in startup phase",
+            strBlockReportId, nodeID);
         return !node.hasStaleStorages();
       }
 
@@ -1836,7 +1839,7 @@ public class BlockManager {
         // ordinary block reports.  This shortens restart times.
         processFirstBlockReport(storageInfo, newReport);
       } else {
-        invalidatedBlocks = processReport(storageInfo, newReport);
+        invalidatedBlocks = processReport(storageInfo, newReport, context);
       }
       
       storageInfo.receivedBlockReport();
@@ -1870,8 +1873,9 @@ public class BlockManager {
 
     if (invalidatedBlocks != null) {
       for (Block b : invalidatedBlocks) {
-        blockLog.info("BLOCK* processReport: {} on node {} size {} does not " +
-            "belong to any file", b, node, b.getNumBytes());
+        blockLog.info("BLOCK* processReport 0x{}: {} on node {} size {} " +
+            "does not belong to any file", strBlockReportId,
+            b, node, b.getNumBytes());
       }
     }
 
@@ -1880,10 +1884,11 @@ public class BlockManager {
     if (metrics != null) {
       metrics.addBlockReport((int) (endTime - startTime));
     }
-    blockLog.info("BLOCK* processReport: from storage {} node {}, " +
-        "blocks: {}, hasStaleStorage: {}, processing time: {} msecs", storage
-        .getStorageID(), nodeID, newReport.getNumberOfBlocks(),
-        node.hasStaleStorages(), (endTime - startTime));
+    blockLog.info("BLOCK* processReport 0x{}: from storage {} node {}, " +
+        "blocks: {}, hasStaleStorage: {}, processing time: {} msecs",
+        strBlockReportId, storage.getStorageID(), nodeID,
+        newReport.getNumberOfBlocks(), node.hasStaleStorages(),
+        (endTime - startTime));
     return !node.hasStaleStorages();
   }
 
@@ -1989,7 +1994,8 @@ public class BlockManager {
   
   private Collection<Block> processReport(
       final DatanodeStorageInfo storageInfo,
-      final BlockListAsLongs report) throws IOException {
+      final BlockListAsLongs report,
+      BlockReportContext context) throws IOException {
     // Normal case:
     // Modify the (block-->datanode) map, according to the difference
     // between the old and new block report.
@@ -2001,6 +2007,11 @@ public class BlockManager {
     Collection<StatefulBlockInfo> toUC = new LinkedList<StatefulBlockInfo>();
     reportDiff(storageInfo, report,
         toAdd, toRemove, toInvalidate, toCorrupt, toUC);
+
+    String strBlockReportId = "";
+    if (context != null) {
+      strBlockReportId = Long.toHexString(context.getReportId());
+    }
    
     DatanodeDescriptor node = storageInfo.getDatanodeDescriptor();
     // Process the blocks on each queue
@@ -2016,8 +2027,8 @@ public class BlockManager {
       numBlocksLogged++;
     }
     if (numBlocksLogged > maxNumBlocksToLog) {
-      blockLog.info("BLOCK* processReport: logged info for {} of {} " +
-          "reported.", maxNumBlocksToLog, numBlocksLogged);
+      blockLog.info("BLOCK* processReport 0x{}: logged info for {} of {} " +
+          "reported.", strBlockReportId, maxNumBlocksToLog, numBlocksLogged);
     }
     for (Block b : toInvalidate) {
       addToInvalidates(b, node);


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