hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: HDFS-10620. StringBuilder created and appended even if logging is disabled. Contributed by Staffan Friberg.
Date Tue, 19 Jul 2016 22:18:52 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 84c785036 -> 2685e16f3


HDFS-10620. StringBuilder created and appended even if logging is disabled. Contributed by
Staffan Friberg.

(cherry picked from commit f7dabe3addf3f6eb32ea9b8ec1354fb442ce4222)


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

Branch: refs/heads/branch-2
Commit: 2685e16f381532d53aea413ce1c0a14181ee7c89
Parents: 84c7850
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Tue Jul 19 15:13:01 2016 -0700
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Tue Jul 19 15:17:31 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hdfs/server/blockmanagement/BlockManager.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2685e16f/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 0f6d6dd..04e349a 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
@@ -1195,16 +1195,19 @@ public class BlockManager implements BlockStatsMXBean {
     if (!isPopulatingReplQueues()) {
       return;
     }
-    StringBuilder datanodes = new StringBuilder();
+    StringBuilder datanodes = blockLog.isDebugEnabled()
+        ? new StringBuilder() : null;
     for (DatanodeStorageInfo storage : blocksMap.getStorages(b)) {
       if (storage.getState() != State.NORMAL) {
         continue;
       }
       final DatanodeDescriptor node = storage.getDatanodeDescriptor();
       invalidateBlocks.add(b, node, false);
-      datanodes.append(node).append(" ");
+      if (datanodes != null) {
+        datanodes.append(node).append(" ");
+      }
     }
-    if (datanodes.length() != 0) {
+    if (datanodes != null & datanodes.length() != 0) {
       blockLog.debug("BLOCK* addToInvalidates: {} {}", b, datanodes);
     }
   }


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