hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1171719 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt src/main/java/org/apache/hadoop/io/compress/SnappyCodec.java
Date Fri, 16 Sep 2011 18:52:38 GMT
Author: todd
Date: Fri Sep 16 18:52:38 2011
New Revision: 1171719

URL: http://svn.apache.org/viewvc?rev=1171719&view=rev
Log:
HADOOP-7608. SnappyCodec check for Hadoop native lib is wrong. Contributed by Alejandro Abdelnur.

Modified:
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/SnappyCodec.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1171719&r1=1171718&r2=1171719&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Fri Sep 16 18:52:38
2011
@@ -591,6 +591,9 @@ Release 0.23.0 - Unreleased
     HADOOP-7629. Allow immutable FsPermission objects to be used as IPC
     parameters. (todd)
 
+    HADOOP-7608. SnappyCodec check for Hadoop native lib is wrong
+    (Alejandro Abdelnur via todd)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/SnappyCodec.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/SnappyCodec.java?rev=1171719&r1=1171718&r2=1171719&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/SnappyCodec.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/SnappyCodec.java
Fri Sep 16 18:52:38 2011
@@ -28,6 +28,7 @@ import org.apache.hadoop.io.compress.sna
 import org.apache.hadoop.io.compress.snappy.SnappyCompressor;
 import org.apache.hadoop.io.compress.snappy.SnappyDecompressor;
 import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.hadoop.util.NativeCodeLoader;
 
 /**
  * This class creates snappy compressors/decompressors.
@@ -63,13 +64,10 @@ public class SnappyCodec implements Conf
   /**
    * Are the native snappy libraries loaded & initialized?
    *
-   * @param conf configuration
    * @return true if loaded & initialized, otherwise false
    */
-  public static boolean isNativeSnappyLoaded(Configuration conf) {
-    return LoadSnappy.isLoaded() && conf.getBoolean(
-        CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY,
-        CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_DEFAULT);
+  public static boolean isNativeCodeLoaded() {
+    return LoadSnappy.isLoaded() && NativeCodeLoader.isNativeCodeLoaded();
   }
 
   /**
@@ -99,7 +97,7 @@ public class SnappyCodec implements Conf
   public CompressionOutputStream createOutputStream(OutputStream out,
                                                     Compressor compressor)
       throws IOException {
-    if (!isNativeSnappyLoaded(conf)) {
+    if (!isNativeCodeLoaded()) {
       throw new RuntimeException("native snappy library not available");
     }
     int bufferSize = conf.getInt(
@@ -119,7 +117,7 @@ public class SnappyCodec implements Conf
    */
   @Override
   public Class<? extends Compressor> getCompressorType() {
-    if (!isNativeSnappyLoaded(conf)) {
+    if (!isNativeCodeLoaded()) {
       throw new RuntimeException("native snappy library not available");
     }
 
@@ -133,7 +131,7 @@ public class SnappyCodec implements Conf
    */
   @Override
   public Compressor createCompressor() {
-    if (!isNativeSnappyLoaded(conf)) {
+    if (!isNativeCodeLoaded()) {
       throw new RuntimeException("native snappy library not available");
     }
     int bufferSize = conf.getInt(
@@ -169,7 +167,7 @@ public class SnappyCodec implements Conf
   public CompressionInputStream createInputStream(InputStream in,
                                                   Decompressor decompressor)
       throws IOException {
-    if (!isNativeSnappyLoaded(conf)) {
+    if (!isNativeCodeLoaded()) {
       throw new RuntimeException("native snappy library not available");
     }
 
@@ -185,7 +183,7 @@ public class SnappyCodec implements Conf
    */
   @Override
   public Class<? extends Decompressor> getDecompressorType() {
-    if (!isNativeSnappyLoaded(conf)) {
+    if (!isNativeCodeLoaded()) {
       throw new RuntimeException("native snappy library not available");
     }
 
@@ -199,7 +197,7 @@ public class SnappyCodec implements Conf
    */
   @Override
   public Decompressor createDecompressor() {
-    if (!isNativeSnappyLoaded(conf)) {
+    if (!isNativeCodeLoaded()) {
       throw new RuntimeException("native snappy library not available");
     }
     int bufferSize = conf.getInt(



Mime
View raw message