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: fix setting 'compaction_strategy_class' using CQL introduced by CASSANDRA-3374
Date Mon, 30 Jan 2012 16:21:48 GMT
fix setting 'compaction_strategy_class' using CQL introduced by CASSANDRA-3374


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

Branch: refs/heads/trunk
Commit: f4064b5ff1c1d14736afdb35493ade0db033668f
Parents: 43003f0
Author: Pavel Yaskevich <xedin@apache.org>
Authored: Mon Jan 30 19:10:54 2012 +0200
Committer: Pavel Yaskevich <xedin@apache.org>
Committed: Mon Jan 30 19:12:41 2012 +0200

----------------------------------------------------------------------
 .../cassandra/cql/CreateColumnFamilyStatement.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4064b5f/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
index 1095a72..c0568b9 100644
--- a/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
+++ b/src/java/org/apache/cassandra/cql/CreateColumnFamilyStatement.java
@@ -37,6 +37,7 @@ import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ColumnDefinition;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.db.ColumnFamilyType;
+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.thrift.InvalidRequestException;
@@ -114,6 +115,7 @@ public class CreateColumnFamilyStatement
     private final Map<String, String> properties = new HashMap<String, String>();
     private List<String> keyValidator = new ArrayList<String>();
     private ByteBuffer keyAlias = null;
+    private Class<? extends AbstractCompactionStrategy> compactionStrategyClass;
     private final Map<String, String> compactionStrategyOptions = new HashMap<String,
String>();
     private final Map<String, String> compressionParameters = new HashMap<String,
String>();
 
@@ -125,6 +127,17 @@ public class CreateColumnFamilyStatement
     /** Perform validation of parsed params */
     private void validate() throws InvalidRequestException
     {
+        String compStrategy = getPropertyString(KW_COMPACTION_STRATEGY_CLASS, CFMetaData.DEFAULT_COMPACTION_STRATEGY_CLASS);
+
+        try
+        {
+            compactionStrategyClass = CFMetaData.createCompactionStrategy(compStrategy);
+        }
+        catch (ConfigurationException e)
+        {
+            throw new InvalidRequestException(e.getMessage());
+        }
+
         // we need to remove parent:key = value pairs from the main properties
         Set<String> propsToRemove = new HashSet<String>();
 
@@ -338,6 +351,7 @@ public class CreateColumnFamilyStatement
                    .keyValidator(TypeParser.parse(comparators.get(getKeyType())))
                    .rowCacheProvider(FBUtilities.newCacheProvider(getPropertyString(KW_ROW_CACHE_PROVIDER,
CFMetaData.DEFAULT_ROW_CACHE_PROVIDER.getClass().getName())))
                    .keyAlias(keyAlias)
+                   .compactionStrategyClass(compactionStrategyClass)
                    .compactionStrategyOptions(compactionStrategyOptions)
                    .compressionParameters(CompressionParameters.create(compressionParameters))
                    .validate();


Mime
View raw message