hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject hadoop git commit: HDFS-9350. Avoid creating temprorary strings in Block.toString() and getBlockName() (Staffan Friberg via cmccabe)
Date Fri, 18 Dec 2015 17:50:26 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk f349d0a76 -> e63388fdf


HDFS-9350. Avoid creating temprorary strings in Block.toString() and getBlockName() (Staffan
Friberg via cmccabe)


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

Branch: refs/heads/trunk
Commit: e63388fdf22b5fd20ca00f9fad9f40656f117d95
Parents: f349d0a
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Fri Dec 18 09:40:39 2015 -0800
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Fri Dec 18 09:40:39 2015 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/hdfs/protocol/Block.java  | 7 +++++--
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                   | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e63388fd/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/Block.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/Block.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/Block.java
index 2b139b2..23bfa95 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/Block.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/Block.java
@@ -132,7 +132,8 @@ public class Block implements Writable, Comparable<Block> {
   /**
    */
   public String getBlockName() {
-    return BLOCK_FILE_PREFIX + String.valueOf(blockId);
+    return new StringBuilder().append(BLOCK_FILE_PREFIX)
+        .append(blockId).toString();
   }
 
   /**
@@ -160,7 +161,9 @@ public class Block implements Writable, Comparable<Block> {
    * @return the string representation of the block
    */
   public static String toString(final Block b) {
-    return b.getBlockName() + "_" + b.getGenerationStamp();
+    StringBuilder sb = new StringBuilder();
+    b.appendStringTo(sb);
+    return sb.toString();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e63388fd/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 3fee90d..76d5c24 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -910,6 +910,9 @@ Release 2.9.0 - UNRELEASED
     HDFS-8477. describe dfs.ha.zkfc.port in hdfs-default.xml.
     (Kanaka Kumar Avvaru via wang)
 
+    HDFS-9350. Avoid creating temprorary strings in Block.toString() and
+    getBlockName() (Staffan Friberg via cmccabe)
+
   OPTIMIZATIONS
 
   BUG FIXES


Mime
View raw message