cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1101598 - in /cassandra/branches/cassandra-0.8.1: ./ contrib/ drivers/java/src/org/apache/cassandra/cql/jdbc/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/cql/ s...
Date Tue, 10 May 2011 19:03:59 GMT
Author: jbellis
Date: Tue May 10 19:03:58 2011
New Revision: 1101598

URL: http://svn.apache.org/viewvc?rev=1101598&view=rev
Log:
merge from 0.8

Modified:
    cassandra/branches/cassandra-0.8.1/   (props changed)
    cassandra/branches/cassandra-0.8.1/CHANGES.txt
    cassandra/branches/cassandra-0.8.1/NEWS.txt
    cassandra/branches/cassandra-0.8.1/contrib/   (props changed)
    cassandra/branches/cassandra-0.8.1/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java
    cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
  (props changed)
    cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
  (props changed)
    cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
  (props changed)
    cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
  (props changed)
    cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
  (props changed)
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/KSMetaData.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/cql/QueryProcessor.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/SimpleStrategy.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/CassandraServer.java
    cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/ThriftValidation.java
    cassandra/branches/cassandra-0.8.1/src/resources/org/apache/cassandra/cli/CliHelp.yaml

Propchange: cassandra/branches/cassandra-0.8.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 19:03:58 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7:1026516-1100900,1101021
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
-/cassandra/branches/cassandra-0.8:1090935-1101205
+/cassandra/branches/cassandra-0.8:1090935-1101597
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
 /incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350

Modified: cassandra/branches/cassandra-0.8.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/CHANGES.txt?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8.1/CHANGES.txt Tue May 10 19:03:58 2011
@@ -27,6 +27,8 @@
  * r/m clustertool (CASSANDRA-2607)
  * add support for presenting row key as a column in CQL result sets 
    (CASSANDRA-2622)
+ * Don't allow {LOCAL|EACH}_QUORUM unless strategy is NTS (CASSANDRA-2627)
+ * validate keyspace strategy_options during CQL create (CASSANDRA-2624)
 
 
 0.8.0-beta2
@@ -54,12 +56,11 @@
  * improve ignoring of obsolete mutations in index maintenance (CASSANDRA-2401)
  * recognize attempt to drop just the index while leaving the column
    definition alone (CASSANDRA-2619)
- * Don't allow {LOCAL|EACH}_QUORUM unless strategy is NTS (CASSANDRA-2627)
 
 
 0.8.0-beta1
  * remove Avro RPC support (CASSANDRA-926)
- * adds support for columns that act as incr/decr counters 
+ * support for columns that act as incr/decr counters 
    (CASSANDRA-1072, 1937, 1944, 1936, 2101, 2093, 2288, 2105, 2384, 2236, 2342,
    2454)
  * CQL (CASSANDRA-1703, 1704, 1705, 1706, 1707, 1708, 1710, 1711, 1940, 

Modified: cassandra/branches/cassandra-0.8.1/NEWS.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/NEWS.txt?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/NEWS.txt (original)
+++ cassandra/branches/cassandra-0.8.1/NEWS.txt Tue May 10 19:03:58 2011
@@ -5,19 +5,18 @@ Upgrading
 ---------
     - Upgrading from version 0.7.1 or later can be done with a rolling
       restart, one node at a time.  You do not need to bring down the
-      whole cluster.
+      whole cluster at once.
     - Running nodetool drain before shutting down the 0.7 node is
       recommended but not required. (Skipping this will result in
       replay of entire commitlog, so it will take longer to restart but
       is otherwise harmless.)
+    - 0.8 is fully API-compatible with 0.7.  You can continue
+      to use your 0.7 clients.
     - Avro record classes used in map/reduce and Hadoop streaming code have
       moved from org.apache.cassandra.avro to org.apache.cassandra.hadoop.avro,
       applications using these classes will need to be updated accordingly.
     - The loadbalance command has been removed from nodetool.  For similar
       behavior, decommission then rebootstrap with empty initial_token.
-    - repair now works on a token range, rather than the entire ring. This
-      means that "run repair against each node" will now repair the ring with
-      no redundant work.
 
 Features
 --------

Propchange: cassandra/branches/cassandra-0.8.1/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 19:03:58 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/contrib:922689-1052356,1052358-1053452,1053454,1053456-1068009
 /cassandra/branches/cassandra-0.7/contrib:1026516-1100900,1101021
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
-/cassandra/branches/cassandra-0.8/contrib:1090935-1101205
+/cassandra/branches/cassandra-0.8/contrib:1090935-1101597
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/contrib:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/contrib:810145-810987,810994-834239,834349-834350

Modified: cassandra/branches/cassandra-0.8.1/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java
(original)
+++ cassandra/branches/cassandra-0.8.1/drivers/java/src/org/apache/cassandra/cql/jdbc/ColumnDecoder.java
Tue May 10 19:03:58 2011
@@ -28,7 +28,6 @@ import org.apache.cassandra.db.marshal.A
 import org.apache.cassandra.db.marshal.AsciiType;
 import org.apache.cassandra.thrift.*;
 import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.FBUtilities;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -59,7 +58,7 @@ class ColumnDecoder
             {
                 try
                 {
-                    metadata.put(String.format("%s.%s", ks.getName(), cf.getName()), CFMetaData.convertToCFMetaData(cf));
+                    metadata.put(String.format("%s.%s", ks.getName(), cf.getName()), CFMetaData.fromThrift(cf));
                 }
                 catch (InvalidRequestException e)
                 {

Propchange: cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 19:03:58 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1100900,1101021
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090935-1101205
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090935-1101597
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350

Propchange: cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 19:03:58 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1100900,1101021
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090935-1101205
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090935-1101597
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350

Propchange: cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 19:03:58 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1100900,1101021
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090935-1101205
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090935-1101597
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350

Propchange: cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 19:03:58 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1100900,1101021
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090935-1101205
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090935-1101597
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350

Propchange: cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 10 19:03:58 2011
@@ -1,7 +1,7 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1052356,1052358-1053452,1053454,1053456-1081914,1083000
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1100900,1101021
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090935-1101205
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090935-1101597
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/CFMetaData.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/CFMetaData.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/CFMetaData.java
Tue May 10 19:03:58 2011
@@ -629,7 +629,7 @@ public final class CFMetaData
             cf_def.setRow_cache_provider(CFMetaData.DEFAULT_ROW_CACHE_PROVIDER);
     }
 
-    public static CFMetaData convertToCFMetaData(org.apache.cassandra.thrift.CfDef cf_def)
throws InvalidRequestException, ConfigurationException
+    public static CFMetaData fromThrift(org.apache.cassandra.thrift.CfDef cf_def) throws
InvalidRequestException, ConfigurationException
     {
         ColumnFamilyType cfType = ColumnFamilyType.create(cf_def.column_type);
         if (cfType == null)

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/KSMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/KSMetaData.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/KSMetaData.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/config/KSMetaData.java
Tue May 10 19:03:58 2011
@@ -18,10 +18,7 @@
 
 package org.apache.cassandra.config;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import java.util.*;
 
 import org.apache.commons.lang.ObjectUtils;
 
@@ -29,6 +26,7 @@ import org.apache.avro.util.Utf8;
 import org.apache.cassandra.io.SerDeUtils;
 import org.apache.cassandra.locator.AbstractReplicationStrategy;
 import org.apache.cassandra.locator.NetworkTopologyStrategy;
+import org.apache.cassandra.thrift.CfDef;
 import org.apache.cassandra.thrift.KsDef;
 
 import org.apache.commons.lang.StringUtils;
@@ -51,7 +49,7 @@ public final class KSMetaData
         this.cfMetaData = Collections.unmodifiableMap(cfmap);
     }
 
-    public static Map<String, String> backwardsCompatibleOptions(KsDef ks_def)
+    public static Map<String, String> forwardsCompatibleOptions(KsDef ks_def)
     {
         Map<String, String> options;
         if (ks_def.isSetReplication_factor())
@@ -165,4 +163,24 @@ public final class KSMetaData
         ret.put("replication_factor", rf.toString());
         return ret;
     }
+
+    public static KSMetaData fromThrift(KsDef ksd, CFMetaData... cfDefs) throws ConfigurationException
+    {
+        return new KSMetaData(ksd.name,
+                              AbstractReplicationStrategy.getClass(ksd.strategy_class),
+                              forwardsCompatibleOptions(ksd),
+                              cfDefs);
+    }
+
+    public static KsDef toThrift(KSMetaData ksm)
+    {
+        List<CfDef> cfDefs = new ArrayList<CfDef>();
+        for (CFMetaData cfm : ksm.cfMetaData().values())
+            cfDefs.add(CFMetaData.convertToThrift(cfm));
+        KsDef ksdef = new KsDef(ksm.name, ksm.strategyClass.getName(), cfDefs);
+        ksdef.setStrategy_options(ksm.strategyOptions);
+        if (ksm.strategyOptions != null && ksm.strategyOptions.containsKey("replication_factor"))
+            ksdef.setReplication_factor(Integer.parseInt(ksm.strategyOptions.get("replication_factor")));
+        return ksdef;
+    }
 }

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/cql/QueryProcessor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/cql/QueryProcessor.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/cql/QueryProcessor.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/cql/QueryProcessor.java
Tue May 10 19:03:58 2011
@@ -638,10 +638,12 @@ public class QueryProcessor
                 
                 try
                 {
-                    KSMetaData ksm = new KSMetaData(create.getName(),
-                                                    AbstractReplicationStrategy.getClass(create.getStrategyClass()),
-                                                    create.getStrategyOptions());
-                    applyMigrationOnStage(new AddKeyspace(ksm));
+                    KsDef ksd = new KsDef(create.getName(),
+                                          create.getStrategyClass(),
+                                          Collections.<org.apache.cassandra.thrift.CfDef>emptyList())
+                                .setStrategy_options(create.getStrategyOptions());
+                    ThriftValidation.validateKsDef(ksd);
+                    applyMigrationOnStage(new AddKeyspace(KSMetaData.fromThrift(ksd)));
                 }
                 catch (ConfigurationException e)
                 {

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java
Tue May 10 19:03:58 2011
@@ -289,4 +289,19 @@ public abstract class AbstractReplicatio
         String className = cls.contains(".") ? cls : "org.apache.cassandra.locator." + cls;
         return FBUtilities.classForName(className, "replication strategy");
     }
+
+    protected void validateReplicationFactor(String rf) throws ConfigurationException
+    {
+        try
+        {
+            if (Integer.parseInt(rf) < 0)
+            {
+                throw new ConfigurationException("Replication factor must be non-negative;
found " + rf);
+            }
+        }
+        catch (NumberFormatException e2)
+        {
+            throw new ConfigurationException("Replication factor must be numeric; found "
+ rf);
+        }
+    }
 }

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
Tue May 10 19:03:58 2011
@@ -146,13 +146,9 @@ public class NetworkTopologyStrategy ext
 
     public void validateOptions() throws ConfigurationException
     {
-        for (Entry<String,String> e : this.configOptions.entrySet())
+        for (Entry<String, String> e : this.configOptions.entrySet())
         {
-            int rf = Integer.parseInt(e.getValue());
-            if (rf < 0)
-            {
-                throw new ConfigurationException("Replication factor for NTS must be non-negative.
dc: " +e.getKey()+", rf: "+rf);
-            }
+            validateReplicationFactor(e.getValue());
         }
 
     }

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/OldNetworkTopologyStrategy.java
Tue May 10 19:03:58 2011
@@ -111,18 +111,10 @@ public class OldNetworkTopologyStrategy 
 
     public void validateOptions() throws ConfigurationException
     {
-        if (this.configOptions == null)
+        if (configOptions == null || configOptions.get("replication_factor") == null)
         {
-            throw new ConfigurationException("OldNetworkTopologyStrategy requires a replication_factor
strategy option.");
-        }
-        if (this.configOptions.get("replication_factor") == null)
-        {
-            throw new ConfigurationException("OldNetworkTopologyStrategy requires a replication_factor
strategy option.");
-        }
-        int rf = Integer.parseInt(this.configOptions.get("replication_factor"));
-        if (rf < 0)
-        {
-            throw new ConfigurationException("Replication factor for OldNetworkTopologyStrategy
must be non-negative, "+rf+" given.");
+            throw new ConfigurationException("SimpleStrategy requires a replication_factor
strategy option.");
         }
+        validateReplicationFactor(configOptions.get("replication_factor"));
     }
 }

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/SimpleStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/SimpleStrategy.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/SimpleStrategy.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/locator/SimpleStrategy.java
Tue May 10 19:03:58 2011
@@ -70,18 +70,10 @@ public class SimpleStrategy extends Abst
 
     public void validateOptions() throws ConfigurationException
     {
-        if (this.configOptions == null)
+        if (configOptions == null || configOptions.get("replication_factor") == null)
         {
             throw new ConfigurationException("SimpleStrategy requires a replication_factor
strategy option.");
         }
-        if (this.configOptions.get("replication_factor") == null)
-        {
-            throw new ConfigurationException("SimpleStrategy requires a replication_factor
strategy option.");
-        }
-        int rf = Integer.parseInt(this.configOptions.get("replication_factor"));
-        if (rf < 0)
-        {
-            throw new ConfigurationException("Replication factor for SimpleStrategy must
be non-negative, "+rf+" given.");
-        }
+        validateReplicationFactor(configOptions.get("replication_factor"));
     }
 }

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/CassandraServer.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/CassandraServer.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/CassandraServer.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/CassandraServer.java
Tue May 10 19:03:58 2011
@@ -578,12 +578,7 @@ public class CassandraServer implements 
         if (ksm == null)
             throw new NotFoundException();
 
-        List<CfDef> cfDefs = new ArrayList<CfDef>();
-        for (CFMetaData cfm : ksm.cfMetaData().values())
-            cfDefs.add(CFMetaData.convertToThrift(cfm));
-        KsDef ksdef = new KsDef(ksm.name, ksm.strategyClass.getName(), cfDefs);
-        ksdef.setStrategy_options(ksm.strategyOptions);
-        return ksdef;
+        return KSMetaData.toThrift(ksm);
     }
 
     public List<KeySlice> get_range_slices(ColumnParent column_parent, SlicePredicate
predicate, KeyRange range, ConsistencyLevel consistency_level)
@@ -809,7 +804,7 @@ public class CassandraServer implements 
 
         try
         {
-            applyMigrationOnStage(new AddColumnFamily(CFMetaData.convertToCFMetaData(cf_def)));
+            applyMigrationOnStage(new AddColumnFamily(CFMetaData.fromThrift(cf_def)));
             return DatabaseDescriptor.getDefsVersion().toString();
         }
         catch (ConfigurationException e)
@@ -874,16 +869,11 @@ public class CassandraServer implements 
             for (CfDef cfDef : ks_def.cf_defs)
             {
                 ThriftValidation.validateCfDef(cfDef);
-                cfDefs.add(CFMetaData.convertToCFMetaData(cfDef));
+                cfDefs.add(CFMetaData.fromThrift(cfDef));
             }
 
             ThriftValidation.validateKsDef(ks_def);
-            KSMetaData ksm = new KSMetaData(ks_def.name,
-                                            AbstractReplicationStrategy.getClass(ks_def.strategy_class),
-                                            KSMetaData.backwardsCompatibleOptions(ks_def),
-                                            cfDefs.toArray(new CFMetaData[cfDefs.size()]));
-
-            applyMigrationOnStage(new AddKeyspace(ksm));
+            applyMigrationOnStage(new AddKeyspace(KSMetaData.fromThrift(ks_def, cfDefs.toArray(new
CFMetaData[cfDefs.size()]))));
             return DatabaseDescriptor.getDefsVersion().toString();
         }
         catch (ConfigurationException e)
@@ -941,10 +931,7 @@ public class CassandraServer implements 
         try
         {
             ThriftValidation.validateKsDef(ks_def);
-            KSMetaData ksm = new KSMetaData(ks_def.name,
-                                            AbstractReplicationStrategy.getClass(ks_def.strategy_class),
-                                            KSMetaData.backwardsCompatibleOptions(ks_def));
-            applyMigrationOnStage(new UpdateKeyspace(ksm));
+            applyMigrationOnStage(new UpdateKeyspace(KSMetaData.fromThrift(ks_def)));
             return DatabaseDescriptor.getDefsVersion().toString();
         }
         catch (ConfigurationException e)

Modified: cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/ThriftValidation.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/ThriftValidation.java
(original)
+++ cassandra/branches/cassandra-0.8.1/src/java/org/apache/cassandra/thrift/ThriftValidation.java
Tue May 10 19:03:58 2011
@@ -591,11 +591,11 @@ public class ThriftValidation
         }
     }
 
-    static void validateKsDef(KsDef ks_def) throws ConfigurationException
+    public static void validateKsDef(KsDef ks_def) throws ConfigurationException
     {
         // Attempt to instantiate the ARS, which will throw a ConfigException if
         //  the strategy_options aren't fully formed or if the ARS Classname is invalid.
-        Map<String, String> options = KSMetaData.backwardsCompatibleOptions(ks_def);
+        Map<String, String> options = KSMetaData.forwardsCompatibleOptions(ks_def);
         TokenMetadata tmd = StorageService.instance.getTokenMetadata();
         IEndpointSnitch eps = DatabaseDescriptor.getEndpointSnitch();
         Class<? extends AbstractReplicationStrategy> cls = AbstractReplicationStrategy.getClass(ks_def.strategy_class);

Modified: cassandra/branches/cassandra-0.8.1/src/resources/org/apache/cassandra/cli/CliHelp.yaml
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8.1/src/resources/org/apache/cassandra/cli/CliHelp.yaml?rev=1101598&r1=1101597&r2=1101598&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8.1/src/resources/org/apache/cassandra/cli/CliHelp.yaml
(original)
+++ cassandra/branches/cassandra-0.8.1/src/resources/org/apache/cassandra/cli/CliHelp.yaml
Tue May 10 19:03:58 2011
@@ -391,7 +391,7 @@ commands:
           It is also valid to specify the fully-qualified class name to a class that
           extends org.apache.Cassandra.db.marshal.AbstractType.
 
-        - key_valiation_class: Validator to use for keys.
+        - key_validation_class: Validator to use for keys.
           Default is BytesType which applies no validation.
 
           Supported values are:



Mime
View raw message