hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vvasu...@apache.org
Subject [21/50] [abbrv] hadoop git commit: HDFS-10620. StringBuilder created and appended even if logging is disabled. Contributed by Staffan Friberg.
Date Mon, 25 Jul 2016 08:25:09 GMT
HDFS-10620. StringBuilder created and appended even if logging is disabled. Contributed by
Staffan Friberg.


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

Branch: refs/heads/YARN-4757
Commit: f7dabe3addf3f6eb32ea9b8ec1354fb442ce4222
Parents: 7ddef0f
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:13:01 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/f7dabe3a/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 1a76e09..349b018 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
@@ -1319,7 +1319,8 @@ public class BlockManager implements BlockStatsMXBean {
     if (!isPopulatingReplQueues()) {
       return;
     }
-    StringBuilder datanodes = new StringBuilder();
+    StringBuilder datanodes = blockLog.isDebugEnabled()
+        ? new StringBuilder() : null;
     for (DatanodeStorageInfo storage : blocksMap.getStorages(storedBlock)) {
       if (storage.getState() != State.NORMAL) {
         continue;
@@ -1328,10 +1329,12 @@ public class BlockManager implements BlockStatsMXBean {
       final Block b = getBlockOnStorage(storedBlock, storage);
       if (b != null) {
         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: {} {}", storedBlock, 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