You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2010/11/20 06:29:47 UTC

svn commit: r1037114 - in /cassandra/branches/cassandra-0.7: conf/cassandra.yaml src/java/org/apache/cassandra/config/ColumnDefinition.java src/java/org/apache/cassandra/config/DatabaseDescriptor.java

Author: jbellis
Date: Sat Nov 20 05:29:46 2010
New Revision: 1037114

URL: http://svn.apache.org/viewvc?rev=1037114&view=rev
Log:
revert stuff not supposed to be part of r1037113

Modified:
    cassandra/branches/cassandra-0.7/conf/cassandra.yaml
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/ColumnDefinition.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java

Modified: cassandra/branches/cassandra-0.7/conf/cassandra.yaml
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/conf/cassandra.yaml?rev=1037114&r1=1037113&r2=1037114&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/conf/cassandra.yaml (original)
+++ cassandra/branches/cassandra-0.7/conf/cassandra.yaml Sat Nov 20 05:29:46 2010
@@ -1,9 +1,9 @@
 # Cassandra storage config YAML 
 
-# NOTE:
-#   See http://wiki.apache.org/cassandra/StorageConfiguration for
-#   full explanations of configuration directives
-# /NOTE
+#NOTE !!!!!!!! NOTE 
+# See http://wiki.apache.org/cassandra/StorageConfiguration for
+# full explanations of configuration directives
+#NOTE !!!!!!!! NOTE 
 
 # The name of the cluster. This is mainly used to prevent machines in
 # one logical cluster from joining another.
@@ -73,7 +73,7 @@ commitlog_sync: periodic
 # milliseconds.
 commitlog_sync_period_in_ms: 10000
 
-# Addresses of hosts that are deemed contact points.
+# Addresses of hosts that are deemed contact points. 
 # Cassandra nodes use this list of hosts to find each other and learn
 # the topology of the ring.  You must change this if you are running
 # multiple nodes!
@@ -266,16 +266,10 @@ request_scheduler: org.apache.cassandra.
 #  the index is at the cost of space.
 index_interval: 128
 
-# Keyspaces have ColumnFamilies.        (Usually 1 KS per application.)
-# ColumnFamilies have Rows.             (Usually a dozen CFs per KS.)
-# Rows contain Columns.                 (Many per CF.)
-# Columns contain name:value:timestamp. (Many per Row.)
-# --
-# A KS is most similar to a schema, and a CF is most similar to a relational table.
-#  A Row is similar to a record, and a Column is a unit of datum.
-# --
-# Likewise, Keyspaces, ColumnFamilies, and Columns may carry additional
-# metadata that change their behavior. They are as follows:
+# A ColumnFamily is the Cassandra concept closest to a relational table. 
+#
+# Keyspaces are separate groups of ColumnFamilies.  Except in very
+# unusual circumstances you will have one Keyspace per application.
 #
 # Keyspace required parameters:
 # - name: name of the keyspace; "system" is
@@ -311,10 +305,10 @@ index_interval: 128
 #   different rack in in the first.  Additional datacenters are not
 #   guaranteed to get a replica.  Additional replicas after three are placed
 #   in ring order after the third without regard to rack or datacenter.
+#
 # - replication_factor: Number of replicas of each row
-# Keyspace optional paramaters:
-# - strategy_options: Additional information for the replication strategy.
-# - column_families:
+# - column_families: column families associated with this keyspace
+#
 #     ColumnFamily required parameters:
 #     - name: name of the ColumnFamily.  Must not contain the character "-".
 #     - compare_with: tells Cassandra how to sort the columns for slicing
@@ -346,8 +340,6 @@ index_interval: 128
 #        days). See http://wiki.apache.org/cassandra/DistributedDeletes
 #     - default_validation_class: specifies a validator class to use for
 #        validating all the column values in the CF.
-#     NOTE:
-#     min_ must be less than max_compaction_threshold!
 #     - min_compaction_threshold: the minimum number of SSTables needed
 #        to start a minor compaction.  increasing this will cause minor
 #        compactions to start less frequently and be more intensive. setting
@@ -356,7 +348,6 @@ index_interval: 128
 #        before a minor compaction is forced.  decreasing this will cause
 #        minor compactions to start more frequently and be less intensive.
 #        setting this to 0 disables minor compactions.  defaults to 32.
-#     /NOTE
 #     - row_cache_save_period_in_seconds: number of seconds between saving
 #        row caches.  The row caches can be saved periodically and if one
 #        exists on startup it will be loaded.
@@ -371,25 +362,10 @@ index_interval: 128
 #     - memtable_operations_in_millions: Number of operations in millions
 #        before the memtable is flushed. If undefined, throughput / 64 * 0.3
 #        will be used.
-#     - column_metadata:
-#         Column required parameters:
-#         - name: binds a validator (and optionally an indexer) to columns 
-#            with this name in any row of the enclosing column family.
-#         - validator: like cf.compare_with, an AbstractType that checks
-#            that the value of the column is well-defined.
-#         Column optional parameters:
-#         NOTE:
-#         index_name cannot be set if index_type is not also set!
-#         - index_name: User-friendly name for the index.
-#         - index_type: The type of index to be created. Currently only
-#            KEYS is supported.
-#         /NOTE
-# 
-# NOTE:
-#   this keyspace definition is for demonstration purposes only.
-#   Cassandra will not load these definitions during startup. See
-#   http://wiki.apache.org/cassandra/FAQ#no_keyspaces for an explanation.
-# /NOTE
+#
+# NOTE: this keyspace definition is for demonstration purposes only.
+#       Cassandra will not load these definitions during startup. See
+#       http://wiki.apache.org/cassandra/FAQ#no_keyspaces for an explanation.
 keyspaces:
     - name: Keyspace1
       replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy
@@ -438,5 +414,4 @@ keyspaces:
           column_metadata:
             - name: birthdate
               validator_class: LongType
-              index_name: birthdate_idx
               index_type: KEYS

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/ColumnDefinition.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/ColumnDefinition.java?rev=1037114&r1=1037113&r2=1037114&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/ColumnDefinition.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/ColumnDefinition.java Sat Nov 20 05:29:46 2010
@@ -101,19 +101,17 @@ public class ColumnDefinition {
         }
     }
 
-    public static ColumnDefinition fromColumnDef(ColumnDef thriftColumnDef) throws ConfigurationException
+    public static ColumnDefinition fromColumnDef(ColumnDef cd) throws ConfigurationException
     {
-        validateIndexType(thriftColumnDef);
-        return new ColumnDefinition(thriftColumnDef.name, thriftColumnDef.validation_class, thriftColumnDef.index_type, thriftColumnDef.index_name);
+        return new ColumnDefinition(cd.name, cd.validation_class, cd.index_type, cd.index_name);
     }
     
-    public static ColumnDefinition fromColumnDef(org.apache.cassandra.avro.ColumnDef avroColumnDef) throws ConfigurationException
+    public static ColumnDefinition fromColumnDef(org.apache.cassandra.avro.ColumnDef cd) throws ConfigurationException
     {
-        validateIndexType(avroColumnDef);
-        return new ColumnDefinition(avroColumnDef.name,
-                avroColumnDef.validation_class.toString(),
-                IndexType.valueOf(avroColumnDef.index_type == null ? org.apache.cassandra.avro.CassandraServer.D_COLDEF_INDEXTYPE : avroColumnDef.index_type.name()),
-                avroColumnDef.index_name == null ? org.apache.cassandra.avro.CassandraServer.D_COLDEF_INDEXNAME : avroColumnDef.index_name.toString());
+        return new ColumnDefinition(cd.name,
+                cd.validation_class.toString(),
+                IndexType.valueOf(cd.index_type == null ? org.apache.cassandra.avro.CassandraServer.D_COLDEF_INDEXTYPE : cd.index_type.name()),
+                cd.index_name == null ? org.apache.cassandra.avro.CassandraServer.D_COLDEF_INDEXNAME : cd.index_name.toString());
     }
 
     public static Map<ByteBuffer, ColumnDefinition> fromColumnDef(List<ColumnDef> thriftDefs) throws ConfigurationException
@@ -124,7 +122,6 @@ public class ColumnDefinition {
         Map<ByteBuffer, ColumnDefinition> cds = new TreeMap<ByteBuffer, ColumnDefinition>();
         for (ColumnDef thriftColumnDef : thriftDefs)
         {
-            validateIndexType(thriftColumnDef);
             cds.put(thriftColumnDef.name, fromColumnDef(thriftColumnDef));
         }
 
@@ -139,30 +136,12 @@ public class ColumnDefinition {
         Map<ByteBuffer, ColumnDefinition> cds = new TreeMap<ByteBuffer, ColumnDefinition>();
         for (org.apache.cassandra.avro.ColumnDef avroColumnDef : avroDefs)
         {
-            validateIndexType(avroColumnDef);
             cds.put(avroColumnDef.name, fromColumnDef(avroColumnDef));
         }
 
         return Collections.unmodifiableMap(cds);
     }
 
-    public static void validateIndexType(org.apache.cassandra.thrift.ColumnDef thriftColumnDef) throws ConfigurationException
-    {
-        if ((thriftColumnDef.index_name != null) && (thriftColumnDef.index_type == null))
-        {
-            throw new ConfigurationException("index_name cannot be set if index_type is not also set");
-        }
-    }
-
-    public static void validateIndexType(org.apache.cassandra.avro.ColumnDef avroColumnDef) throws ConfigurationException
-    {
-        if ((avroColumnDef.index_name != null) && (avroColumnDef.index_type == null))
-        {
-            throw new ConfigurationException("index_name cannot be set if index_type is not also set");
-        }
-
-    }
-
     @Override
     public String toString()
     {

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1037114&r1=1037113&r2=1037114&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Sat Nov 20 05:29:46 2010
@@ -585,20 +585,6 @@ public class    DatabaseDescriptor
 
                 for (RawColumnDefinition rcd : cf.column_metadata)
                 {
-                    if (rcd.name == null)
-                    {
-                        throw new ConfigurationException("name is required for column definitions.");
-                    }
-                    if (rcd.validator_class == null)
-                    {
-                        throw new ConfigurationException("validator is required for column definitions");
-                    }
-                    
-                    if ((rcd.index_type == null) && (rcd.index_name != null))
-                    {
-                        throw new ConfigurationException("index_name cannot be set if index_type is not also set");
-                    }
-
                     ByteBuffer columnName = ByteBuffer.wrap(rcd.name.getBytes(Charsets.UTF_8));
                     metadata.put(columnName, new ColumnDefinition(columnName, rcd.validator_class, rcd.index_type, rcd.index_name));
                 }