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: (cql3) fix setting compaction strategy patch by Pavel Yaskevich; reviewed by Jonathan Ellis for CASSANDRA-4597
Date Tue, 04 Sep 2012 11:40:06 GMT
(cql3) fix setting compaction strategy
patch by Pavel Yaskevich; reviewed by Jonathan Ellis for CASSANDRA-4597


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

Branch: refs/heads/trunk
Commit: 5c91bd1420e68c84433681122cb0fb7f5235ad8c
Parents: 6e1f3a0
Author: Pavel Yaskevich <xedin@apache.org>
Authored: Mon Sep 3 12:19:08 2012 +0300
Committer: Pavel Yaskevich <xedin@apache.org>
Committed: Tue Sep 4 14:30:36 2012 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 src/java/org/apache/cassandra/cql3/CFPropDefs.java |   12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5c91bd14/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d3eafe4..b23e9ba 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,7 @@
  * increase stack size under Java7 to 180K
  * Log(info) schema changes (CASSANDRA-4547)
  * Change nodetool setcachecapcity to manipulate global caches (CASSANDRA-4563)
+ * (cql3) fix setting compaction strategy (CASSANDRA-4597)
 Merged from 1.0:
  * fix toString of hint destination tokens (CASSANDRA-4568)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5c91bd14/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 04f0b41..01e14fb 100644
--- a/src/java/org/apache/cassandra/cql3/CFPropDefs.java
+++ b/src/java/org/apache/cassandra/cql3/CFPropDefs.java
@@ -21,10 +21,10 @@ package org.apache.cassandra.cql3;
 import com.google.common.collect.Sets;
 import org.apache.cassandra.config.CFMetaData;
 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;
@@ -90,6 +90,7 @@ public class CFPropDefs
     }
 
     public final Map<String, String> properties = new HashMap<String, String>();
+    private Class<? extends AbstractCompactionStrategy> compactionStrategyClass = null;
     public final Map<String, String> compactionStrategyOptions = new HashMap<String,
String>();
     public final Map<String, String> compressionParameters = new HashMap<String,
String>()
     {{
@@ -126,6 +127,12 @@ public class CFPropDefs
             throw new ConfigurationException(bogus + " is not a valid keyword argument for
CREATE TABLE");
         for (String obsolete : Sets.intersection(properties.keySet(), obsoleteKeywords))
             logger.warn("Ignoring obsolete property {}", obsolete);
+
+        if (properties.containsKey(KW_COMPACTION_STRATEGY_CLASS))
+        {
+            compactionStrategyClass = CFMetaData.createCompactionStrategy(properties.get(KW_COMPACTION_STRATEGY_CLASS));
+            compactionStrategyOptions.remove(KW_COMPACTION_STRATEGY_CLASS);
+        }
     }
 
     /** Map a keyword to the corresponding value */
@@ -173,6 +180,9 @@ public class CFPropDefs
         cfm.caching(CFMetaData.Caching.fromString(getString(KW_CACHING, cfm.getCaching().toString())));
         cfm.bloomFilterFpChance(getDouble(KW_BF_FP_CHANCE, cfm.getBloomFilterFpChance()));
 
+        if (compactionStrategyClass != null)
+            cfm.compactionStrategyClass(compactionStrategyClass);
+
         if (!compactionStrategyOptions.isEmpty())
             cfm.compactionStrategyOptions(new HashMap<String, String>(compactionStrategyOptions));
 


Mime
View raw message