hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1332785 - in /hbase/branches/0.90: ./ src/main/java/org/apache/hadoop/hbase/ src/main/java/org/apache/hadoop/hbase/io/hfile/ src/main/java/org/apache/hadoop/hbase/util/ src/test/java/org/apache/hadoop/hbase/io/hfile/ src/test/java/org/apac...
Date Tue, 01 May 2012 19:12:33 GMT
Author: stack
Date: Tue May  1 19:12:33 2012
New Revision: 1332785

URL: http://svn.apache.org/viewvc?rev=1332785&view=rev
Log:
HBASE-3691 Add compressor support for 'snappy', google's compressor

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/hfile/Compression.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFilePerformance.java
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/util/TestCompressionTest.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1332785&r1=1332784&r2=1332785&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Tue May  1 19:12:33 2012
@@ -32,6 +32,7 @@ Release 0.90.7 - Unreleased
    HBASE-5734  Change hbck sideline root (Jimmy Xiang)
    HBASE-5801  [hbck] Hbck should handle case where some regions have different HTD settings
in .regioninfo files (0.90 specific) (Jimmy Xiang)
    HBASE-5712  Parallelize load of .regioninfo files in diagnostic/repair portion of hbck
+   HBASE-3691  Add compressor support for 'snappy', google's compressor
 
   NEW FEATURE
    HBASE-5128  [uber hbck] Online automated repair of table integrity and region consistency
problems

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java?rev=1332785&r1=1332784&r2=1332785&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/HColumnDescriptor.java Tue May
 1 19:12:33 2012
@@ -432,6 +432,7 @@ public class HColumnDescriptor implement
     switch (type) {
       case LZO: compressionType = "LZO"; break;
       case GZ: compressionType = "GZ"; break;
+      case SNAPPY: compressionType = "SNAPPY"; break;
       default: compressionType = "NONE"; break;
     }
     setValue(COMPRESSION, compressionType);
@@ -456,6 +457,7 @@ public class HColumnDescriptor implement
     switch (type) {
       case LZO: compressionType = "LZO"; break;
       case GZ: compressionType = "GZ"; break;
+      case SNAPPY: compressionType = "SNAPPY"; break;
       default: compressionType = "NONE"; break;
     }
     setValue(COMPRESSION_COMPACT, compressionType);

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/hfile/Compression.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/hfile/Compression.java?rev=1332785&r1=1332784&r2=1332785&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/hfile/Compression.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/io/hfile/Compression.java Tue
May  1 19:12:33 2012
@@ -140,6 +140,25 @@ public final class Compression {
 
         return downStream;
       }
+    },
+    SNAPPY("snappy") {
+      // Use base type to avoid compile-time dependencies.
+      private transient CompressionCodec snappyCodec;
+
+      @Override
+      CompressionCodec getCodec(Configuration conf) {
+        if (snappyCodec == null) {
+          try {
+            Class<?> externalCodec =
+                ClassLoader.getSystemClassLoader().loadClass("org.apache.hadoop.io.compress.SnappyCodec");
+            snappyCodec = (CompressionCodec) ReflectionUtils.newInstance(externalCodec, 
+                conf);
+          } catch (ClassNotFoundException e) {
+            throw new RuntimeException(e);
+          }
+        }
+        return snappyCodec;
+      }
     };
 
     private final Configuration conf;

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java?rev=1332785&r1=1332784&r2=1332785&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java Tue
May  1 19:12:33 2012
@@ -94,7 +94,7 @@ public class CompressionTest {
 
   public static void usage() {
     System.err.println(
-      "Usage: CompressionTest <path> none|gz|lzo\n" +
+      "Usage: CompressionTest <path> none|gz|lzo|snappy\n" +
       "\n" +
       "For example:\n" +
       "  hbase " + CompressionTest.class + " file:///tmp/testfile gz\n");

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFilePerformance.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFilePerformance.java?rev=1332785&r1=1332784&r2=1332785&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFilePerformance.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFilePerformance.java
Tue May  1 19:12:33 2012
@@ -129,7 +129,7 @@ public class TestHFilePerformance extend
    * @param fileType "HFile" or "SequenceFile"
    * @param keyLength
    * @param valueLength
-   * @param codecName "none", "lzo", "gz"
+   * @param codecName "none", "lzo", "gz", "snappy"
    * @param rows number of rows to be written.
    * @param writeMethod used for HFile only.
    * @param minBlockSize used for HFile only.

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java?rev=1332785&r1=1332784&r2=1332785&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileSeek.java
Tue May  1 19:12:33 2012
@@ -281,7 +281,7 @@ public class TestHFileSeek extends TestC
 
     private Options buildOptions() {
       Option compress =
-          OptionBuilder.withLongOpt("compress").withArgName("[none|lzo|gz]")
+          OptionBuilder.withLongOpt("compress").withArgName("[none|lzo|gz|snappy]")
               .hasArg().withDescription("compression scheme").create('c');
 
       Option fileSize =
@@ -446,7 +446,7 @@ public class TestHFileSeek extends TestC
 
     private void validateOptions() throws ParseException {
       if (!compress.equals("none") && !compress.equals("lzo")
-          && !compress.equals("gz")) {
+          && !compress.equals("gz") && !compress.equals("snappy")) {
         throw new ParseException("Unknown compression scheme: " + compress);
       }
 

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/util/TestCompressionTest.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/util/TestCompressionTest.java?rev=1332785&r1=1332784&r2=1332785&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/util/TestCompressionTest.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/util/TestCompressionTest.java
Tue May  1 19:12:33 2012
@@ -54,5 +54,6 @@ public class TestCompressionTest {
     assertFalse(CompressionTest.testCompression("LZO"));
     assertTrue(CompressionTest.testCompression("NONE"));
     assertTrue(CompressionTest.testCompression("GZ"));
+    assertTrue(CompressionTest.testCompression("SNAPPY"));
   }
 }



Mime
View raw message