hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject [17/50] [abbrv] hadoop git commit: HADOOP-11466. FastByteComparisons: do not use UNSAFE_COMPARER on the SPARC architecture because it is slower there (Suman Somasundar via Colin P. McCabe)
Date Mon, 26 Jan 2015 17:44:32 GMT
HADOOP-11466. FastByteComparisons: do not use UNSAFE_COMPARER on the SPARC architecture because
it is slower there (Suman Somasundar via Colin P.  McCabe)


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

Branch: refs/heads/HDFS-EC
Commit: 4ee89ce97b214bcb3e348b2cc2e86f6216d492ad
Parents: f2a8eca
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Wed Jan 21 16:33:02 2015 -0800
Committer: Zhe Zhang <zhz@apache.org>
Committed: Mon Jan 26 09:43:27 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  4 ++++
 .../apache/hadoop/io/FastByteComparisons.java   | 21 +++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4ee89ce9/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 66fd138..abe699a 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -737,6 +737,10 @@ Release 2.7.0 - UNRELEASED
     HADOOP-11327. BloomFilter#not() omits the last bit, resulting in an
     incorrect filter (Eric Payne via jlowe)
 
+    HADOOP-11466. FastByteComparisons: do not use UNSAFE_COMPARER on the SPARC
+    architecture because it is slower there (Suman Somasundar via Colin P.
+    McCabe)
+
 Release 2.6.0 - 2014-11-18
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4ee89ce9/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java
index 3f5881b..a3fea31 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/FastByteComparisons.java
@@ -24,6 +24,9 @@ import java.security.PrivilegedAction;
 
 import sun.misc.Unsafe;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import com.google.common.primitives.Longs;
 import com.google.common.primitives.UnsignedBytes;
 
@@ -33,6 +36,7 @@ import com.google.common.primitives.UnsignedBytes;
  * class to be able to compare arrays that start at non-zero offsets.
  */
 abstract class FastByteComparisons {
+  static final Log LOG = LogFactory.getLog(FastByteComparisons.class);
 
   /**
    * Lexicographically compare two byte arrays.
@@ -71,6 +75,13 @@ abstract class FastByteComparisons {
      * implementation if unable to do so.
      */
     static Comparer<byte[]> getBestComparer() {
+      if (System.getProperty("os.arch").equals("sparc")) {
+        if (LOG.isTraceEnabled()) {
+          LOG.trace("Lexicographical comparer selected for "
+              + "byte aligned system architecture");
+        }
+        return lexicographicalComparerJavaImpl();
+      }
       try {
         Class<?> theClass = Class.forName(UNSAFE_COMPARER_NAME);
 
@@ -78,8 +89,16 @@ abstract class FastByteComparisons {
         @SuppressWarnings("unchecked")
         Comparer<byte[]> comparer =
           (Comparer<byte[]>) theClass.getEnumConstants()[0];
+        if (LOG.isTraceEnabled()) {
+          LOG.trace("Unsafe comparer selected for "
+              + "byte unaligned system architecture");
+        }
         return comparer;
       } catch (Throwable t) { // ensure we really catch *everything*
+        if (LOG.isTraceEnabled()) {
+          LOG.trace(t.getMessage());
+          LOG.trace("Lexicographical comparer selected");
+        }
         return lexicographicalComparerJavaImpl();
       }
     }
@@ -234,4 +253,4 @@ abstract class FastByteComparisons {
       }
     }
   }
-}
\ No newline at end of file
+}


Mime
View raw message