cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject [2/2] git commit: turn compression on by default patch by Pavel Yaskevich; reviewed by Sylvain Lebresne for CASSANDRA-3871
Date Wed, 08 Feb 2012 18:20:44 GMT
turn compression on by default
patch by Pavel Yaskevich; reviewed by Sylvain Lebresne for CASSANDRA-3871


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

Branch: refs/heads/trunk
Commit: 6c70b83d055d9212c9ec8ad9437ed9d8a63a7882
Parents: 1616f3f
Author: Pavel Yaskevich <xedin@apache.org>
Authored: Wed Feb 8 20:57:16 2012 +0300
Committer: Pavel Yaskevich <xedin@apache.org>
Committed: Wed Feb 8 21:15:36 2012 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/config/CFMetaData.java    |    8 ++++++++
 src/java/org/apache/cassandra/cql/CFPropDefs.java  |    7 ++++++-
 src/java/org/apache/cassandra/cql3/CFPropDefs.java |    7 ++++++-
 .../io/compress/CompressionParameters.java         |    2 +-
 5 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c70b83d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index bd718b9..a37ec91 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -67,6 +67,7 @@
    trying to read data (CASSANDRA-3812)
  * fix system tests (CASSANDRA-3827)
  * CQL support for altering key_validation_class in ALTER TABLE (CASSANDRA-3781)
+ * turn compression on by default (CASSANDRA-3871)
 
 
 1.0.8

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c70b83d/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 56ee2c9..d879a2c 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -40,6 +40,7 @@ import org.apache.cassandra.db.marshal.*;
 import org.apache.cassandra.db.migration.Migration;
 import org.apache.cassandra.io.IColumnSerializer;
 import org.apache.cassandra.io.compress.CompressionParameters;
+import org.apache.cassandra.io.compress.SnappyCompressor;
 import org.apache.cassandra.thrift.CfDef;
 import org.apache.cassandra.thrift.ColumnDef;
 import org.apache.cassandra.thrift.IndexType;
@@ -617,6 +618,13 @@ public final class CFMetaData
             cf_def.compaction_strategy = DEFAULT_COMPACTION_STRATEGY_CLASS;
         if (null == cf_def.compaction_strategy_options)
             cf_def.compaction_strategy_options = Collections.emptyMap();
+        if (!cf_def.isSetCompression_options())
+        {
+            cf_def.setCompression_options(new HashMap<String, String>()
+            {{
+                put(CompressionParameters.SSTABLE_COMPRESSION, SnappyCompressor.class.getCanonicalName());
+            }});
+        }
     }
 
     public static CFMetaData fromThrift(org.apache.cassandra.thrift.CfDef cf_def) throws
InvalidRequestException, ConfigurationException

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c70b83d/src/java/org/apache/cassandra/cql/CFPropDefs.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CFPropDefs.java b/src/java/org/apache/cassandra/cql/CFPropDefs.java
index 930494a..896915a 100644
--- a/src/java/org/apache/cassandra/cql/CFPropDefs.java
+++ b/src/java/org/apache/cassandra/cql/CFPropDefs.java
@@ -27,6 +27,8 @@ import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.TypeParser;
+import org.apache.cassandra.io.compress.CompressionParameters;
+import org.apache.cassandra.io.compress.SnappyCompressor;
 import org.apache.cassandra.thrift.InvalidRequestException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -102,7 +104,10 @@ public class CFPropDefs {
     public final Map<String, String> properties = new HashMap<String, String>();
     public Class<? extends AbstractCompactionStrategy> compactionStrategyClass;
     public final Map<String, String> compactionStrategyOptions = new HashMap<String,
String>();
-    public final Map<String, String> compressionParameters = new HashMap<String,
String>();
+    public final Map<String, String> compressionParameters = new HashMap<String,
String>()
+    {{
+        put(CompressionParameters.SSTABLE_COMPRESSION, SnappyCompressor.class.getCanonicalName());
+    }};
 
     public void validate() throws InvalidRequestException
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c70b83d/src/java/org/apache/cassandra/cql3/CFPropDefs.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/CFPropDefs.java b/src/java/org/apache/cassandra/cql3/CFPropDefs.java
index e878e63..63f74b0 100644
--- a/src/java/org/apache/cassandra/cql3/CFPropDefs.java
+++ b/src/java/org/apache/cassandra/cql3/CFPropDefs.java
@@ -23,6 +23,8 @@ import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.TypeParser;
+import org.apache.cassandra.io.compress.CompressionParameters;
+import org.apache.cassandra.io.compress.SnappyCompressor;
 import org.apache.cassandra.thrift.InvalidRequestException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -96,7 +98,10 @@ public class CFPropDefs
 
     public final Map<String, String> properties = new HashMap<String, String>();
     public final Map<String, String> compactionStrategyOptions = new HashMap<String,
String>();
-    public final Map<String, String> compressionParameters = new HashMap<String,
String>();
+    public final Map<String, String> compressionParameters = new HashMap<String,
String>()
+    {{
+        put(CompressionParameters.SSTABLE_COMPRESSION, SnappyCompressor.class.getCanonicalName());
+    }};
 
     public static AbstractType<?> parseType(String type) throws InvalidRequestException
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6c70b83d/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/compress/CompressionParameters.java b/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
index 2336ef6..8ebe8aa 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
@@ -82,7 +82,7 @@ public class CompressionParameters
 
     private static Class<? extends ICompressor> parseCompressorClass(String className)
throws ConfigurationException
     {
-        if (className == null)
+        if (className == null || className.isEmpty())
             return null;
 
         className = className.contains(".") ? className : "org.apache.cassandra.io.compress."
+ className;


Mime
View raw message