cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r981645 - in /cassandra/trunk: ./ interface/ internode/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/migration/
Date Mon, 02 Aug 2010 18:18:41 GMT
Author: gdusbabek
Date: Mon Aug  2 18:18:40 2010
New Revision: 981645

URL: http://svn.apache.org/viewvc?rev=981645&view=rev
Log:
internode structures for migrations. changes migration disk format. patch by stuhood, reviewed
by gdusbabek. CASSANDRA-1308

Added:
    cassandra/trunk/internode/
    cassandra/trunk/internode/cassandra.genavro
Modified:
    cassandra/trunk/build.xml
    cassandra/trunk/interface/cassandra.genavro
    cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java
    cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddKeyspace.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java

Modified: cassandra/trunk/build.xml
URL: http://svn.apache.org/viewvc/cassandra/trunk/build.xml?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/build.xml (original)
+++ cassandra/trunk/build.xml Mon Aug  2 18:18:40 2010
@@ -36,6 +36,8 @@
     <property name="interface.thrift.dir" value="${interface.dir}/thrift"/>
     <property name="interface.thrift.gen-java" value="${interface.thrift.dir}/gen-java"/>
     <property name="interface.avro.dir" value="${interface.dir}/avro"/>
+    <property name="internode.dir" value="${basedir}/internode"/>
+    <property name="internode.avro.dir" value="${internode.dir}/avro"/>
     <property name="test.dir" value="${basedir}/test"/>
     <property name="test.resources" value="${test.dir}/resources"/>
     <property name="test.classes" value="${build.dir}/test/classes"/>
@@ -111,6 +113,7 @@
         <delete dir="${build.classes}" />
         <delete dir="${build.src.gen-java}" />
         <delete dir="${interface.avro.dir}" />
+        <delete dir="${internode.avro.dir}" />
     </target>
     <target depends="clean" name="cleanall"/>
 
@@ -179,6 +182,8 @@
       </taskdef>
       <uptodate property="avroInterfaceUpToDate" srcfile="${interface.dir}/cassandra.genavro"
                   targetfile="${interface.avro.dir}/cassandra.avpr" />
+      <uptodate property="avroINProtoUpToDate" srcfile="${internode.dir}/cassandra.genavro"
+                  targetfile="${internode.avro.dir}/cassandra.avpr" />
     </target>
 
     <target name="avro-generate" depends="avro-interface-generate"
@@ -187,6 +192,7 @@
     <target name="avro-interface-generate" unless="avroInterfaceUpToDate"
             depends="init,check-avro-generate">
             <avromacro protocolname="client" inputfile="${interface.dir}/cassandra.genavro"
outputdir="${interface.avro.dir}" />
+            <avromacro protocolname="internode" inputfile="${internode.dir}/cassandra.genavro"
outputdir="${internode.avro.dir}" />
     </target>
 
     <macrodef name="avromacro">
@@ -264,11 +270,14 @@
             <src path="${build.src.gen-java}"/>
             <src path="${interface.thrift.dir}/gen-java"/>
             <src path="${interface.avro.dir}"/>
+            <src path="${internode.avro.dir}"/>
             <classpath refid="cassandra.classpath"/>
         </javac>
 
         <paranamer sourceDirectory="${interface.avro.dir}"
                outputDirectory="${build.classes}"/>
+        <paranamer sourceDirectory="${internode.avro.dir}"
+               outputDirectory="${build.classes}"/>
 
         <antcall target="createVersionPropFile"/>
     </target>

Modified: cassandra/trunk/interface/cassandra.genavro
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.genavro?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.genavro (original)
+++ cassandra/trunk/interface/cassandra.genavro Mon Aug  2 18:18:40 2010
@@ -82,11 +82,13 @@ protocol Cassandra {
         union { Deletion, null } deletion;
     }
 
+    /* NB: Until AVRO-495: must be kept sync'd with private fields. */
     enum IndexType {
         KEYS
     }
 
     /* describes a column in a column family. */
+    /* NB: Until AVRO-495: must be kept sync'd with private fields. */
     record ColumnDef {
         bytes name;
         string validation_class;
@@ -98,6 +100,7 @@ protocol Cassandra {
      * describes a keyspace:
      * NB: the id field is ignored during column family creation: the server will choose
an appropriate value.
      */
+    /* NB: Until AVRO-495: must be kept sync'd with private fields. */
     record CfDef {
         string keyspace;
         string name;
@@ -117,6 +120,7 @@ protocol Cassandra {
     }
 
     /* describes a keyspace. */
+    /* NB: Until AVRO-495: must be kept sync'd with private fields. */
     record KsDef {
         string name;
         string strategy_class;

Added: cassandra/trunk/internode/cassandra.genavro
URL: http://svn.apache.org/viewvc/cassandra/trunk/internode/cassandra.genavro?rev=981645&view=auto
==============================================================================
--- cassandra/trunk/internode/cassandra.genavro (added)
+++ cassandra/trunk/internode/cassandra.genavro Mon Aug  2 18:18:40 2010
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Cassandra internal/internode communication protocol
+ */
+@namespace("org.apache.cassandra")
+
+protocol InterNode {
+    /* NB: Until AVRO-495: must be kept sync'd with the public IndexType. */
+    @namespace("org.apache.cassandra.config.avro")
+    enum IndexType {
+        KEYS
+    }
+
+    /* NB: Until AVRO-495: must be kept sync'd with ColumnDefinition and the public ColumnDef.
*/
+    @namespace("org.apache.cassandra.config.avro")
+    record ColumnDef {
+        bytes name;
+        string validation_class;
+        union { IndexType, null } index_type;
+        union { string, null } index_name;
+    }
+
+    /* NB: Until AVRO-495: must be kept sync'd with CFMetaData and the public CfDef. */
+    @namespace("org.apache.cassandra.config.avro")
+    record CfDef {
+        string keyspace;
+        string name;
+        union { string, null } column_type;
+        union { string, null } clock_type;
+        union { string, null } comparator_type;
+        union { string, null } subcomparator_type;
+        union { string, null } reconciler;
+        union { string, null } comment;
+        union { double, null } row_cache_size;
+        union { boolean, null } preload_row_cache;
+        union { double, null } key_cache_size;
+        union { double, null } read_repair_chance;
+        union { int, null } gc_grace_seconds;
+        union { array<ColumnDef>, null } column_metadata;
+        union { int, null } id;
+    }
+
+    /* NB: Until AVRO-495: must be kept sync'd with KSMetaData and the public KsDef. */
+    @namespace("org.apache.cassandra.config.avro")
+    record KsDef {
+        string name;
+        string strategy_class;
+        union{ map<string>, null } strategy_options;
+        int replication_factor;
+        array<CfDef> cf_defs;
+    }
+}

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Mon Aug  2 18:18:40
2010
@@ -206,9 +206,9 @@ public final class CFMetaData
                + "Columns Sorted By: " + comparator + "\n";
     }
 
-    public org.apache.cassandra.avro.CfDef deflate()
+    public org.apache.cassandra.config.avro.CfDef deflate()
     {
-        org.apache.cassandra.avro.CfDef cf = new org.apache.cassandra.avro.CfDef();
+        org.apache.cassandra.config.avro.CfDef cf = new org.apache.cassandra.config.avro.CfDef();
         cf.id = cfId;
         cf.keyspace = new Utf8(tableName);
         cf.name = new Utf8(cfName);
@@ -225,13 +225,13 @@ public final class CFMetaData
         cf.read_repair_chance = readRepairChance;
         cf.gc_grace_seconds = gcGraceSeconds;
         cf.column_metadata = SerDeUtils.createArray(column_metadata.size(),
-                                                    org.apache.cassandra.avro.ColumnDef.SCHEMA$);
+                                                    org.apache.cassandra.config.avro.ColumnDef.SCHEMA$);
         for (ColumnDefinition cd : column_metadata.values())
             cf.column_metadata.add(cd.deflate());
         return cf;
     }
 
-    public static CFMetaData inflate(org.apache.cassandra.avro.CfDef cf) throws ConfigurationException
+    public static CFMetaData inflate(org.apache.cassandra.config.avro.CfDef cf) throws ConfigurationException
     {
         AbstractType comparator = DatabaseDescriptor.getComparator(cf.comparator_type.toString());
         AbstractType subcolumnComparator = null;
@@ -247,7 +247,7 @@ public final class CFMetaData
             throw new ConfigurationException("Could not create Reconciler of type " + cf.reconciler,
ex);
         }
         Map<byte[], ColumnDefinition> column_metadata = new TreeMap<byte[], ColumnDefinition>(FBUtilities.byteArrayComparator);
-        Iterator<org.apache.cassandra.avro.ColumnDef> cditer = cf.column_metadata.iterator();
+        Iterator<org.apache.cassandra.config.avro.ColumnDef> cditer = cf.column_metadata.iterator();
         while (cditer.hasNext())
         {
             ColumnDefinition cd = ColumnDefinition.inflate(cditer.next());

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java Mon Aug  2
18:18:40 2010
@@ -54,18 +54,18 @@ public class ColumnDefinition {
         return result;
     }
 
-    public org.apache.cassandra.avro.ColumnDef deflate()
+    public org.apache.cassandra.config.avro.ColumnDef deflate()
     {
-        org.apache.cassandra.avro.ColumnDef cd = new org.apache.cassandra.avro.ColumnDef();
+        org.apache.cassandra.config.avro.ColumnDef cd = new org.apache.cassandra.config.avro.ColumnDef();
         cd.name = ByteBuffer.wrap(name);
         cd.validation_class = new Utf8(validator.getClass().getName());
         cd.index_type = index_type == null ? null :
-            Enum.valueOf(org.apache.cassandra.avro.IndexType.class, index_type.name());
+            Enum.valueOf(org.apache.cassandra.config.avro.IndexType.class, index_type.name());
         cd.index_name = index_name == null ? null : new Utf8(index_name);
         return cd;
     }
 
-    public static ColumnDefinition inflate(org.apache.cassandra.avro.ColumnDef cd) throws
ConfigurationException
+    public static ColumnDefinition inflate(org.apache.cassandra.config.avro.ColumnDef cd)
throws ConfigurationException
     {
         byte[] name = new byte[cd.name.remaining()];
         cd.name.get(name, 0, name.length);

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java Mon Aug  2 18:18:40
2010
@@ -72,9 +72,9 @@ public final class KSMetaData
         return cfMetaData;
     }
         
-    public org.apache.cassandra.avro.KsDef deflate()
+    public org.apache.cassandra.config.avro.KsDef deflate()
     {
-        org.apache.cassandra.avro.KsDef ks = new org.apache.cassandra.avro.KsDef();
+        org.apache.cassandra.config.avro.KsDef ks = new org.apache.cassandra.config.avro.KsDef();
         ks.name = new Utf8(name);
         ks.strategy_class = new Utf8(strategyClass.getName());
         if (strategyOptions != null)
@@ -86,13 +86,13 @@ public final class KSMetaData
             }
         }
         ks.replication_factor = replicationFactor;
-        ks.cf_defs = SerDeUtils.createArray(cfMetaData.size(), org.apache.cassandra.avro.CfDef.SCHEMA$);
+        ks.cf_defs = SerDeUtils.createArray(cfMetaData.size(), org.apache.cassandra.config.avro.CfDef.SCHEMA$);
         for (CFMetaData cfm : cfMetaData.values())
             ks.cf_defs.add(cfm.deflate());
         return ks;
     }
 
-    public static KSMetaData inflate(org.apache.cassandra.avro.KsDef ks) throws ConfigurationException
+    public static KSMetaData inflate(org.apache.cassandra.config.avro.KsDef ks) throws ConfigurationException
     {
         Class<AbstractReplicationStrategy> repStratClass;
         try
@@ -114,7 +114,7 @@ public final class KSMetaData
         }
         int cfsz = (int)ks.cf_defs.size();
         CFMetaData[] cfMetaData = new CFMetaData[cfsz];
-        Iterator<org.apache.cassandra.avro.CfDef> cfiter = ks.cf_defs.iterator();
+        Iterator<org.apache.cassandra.config.avro.CfDef> cfiter = ks.cf_defs.iterator();
         for (int i = 0; i < cfsz; i++)
             cfMetaData[i] = CFMetaData.inflate(cfiter.next());
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java Mon Aug  2 18:18:40 2010
@@ -19,7 +19,6 @@
 package org.apache.cassandra.db;
 
 import org.apache.avro.Schema;
-import org.apache.avro.io.BinaryDecoder;
 
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
@@ -75,7 +74,7 @@ public class DefsTable
         rm.add(new QueryPath(Migration.SCHEMA_CF,
                              null,
                              DEFINITION_SCHEMA_COLUMN_NAME),
-                             org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8),
+                             org.apache.cassandra.config.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8),
                              now);
         rm.apply();
 
@@ -109,7 +108,7 @@ public class DefsTable
             {
                 if (Arrays.equals(column.name(), DEFINITION_SCHEMA_COLUMN_NAME))
                     continue;
-                org.apache.cassandra.avro.KsDef ks = SerDeUtils.<org.apache.cassandra.avro.KsDef>deserialize(schema,
column.value());
+                org.apache.cassandra.config.avro.KsDef ks = SerDeUtils.<org.apache.cassandra.config.avro.KsDef>deserialize(schema,
column.value());
                 keyspaces.add(KSMetaData.inflate(ks));
             }
         }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddColumnFamily.java Mon Aug
 2 18:18:40 2010
@@ -1,7 +1,6 @@
 package org.apache.cassandra.db.migration;
 
 import org.apache.avro.Schema;
-import org.apache.avro.io.BinaryDecoder;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ConfigurationException;
@@ -53,7 +52,7 @@ public class AddColumnFamily extends Mig
         // deserialize cf
         try
         {
-            cfm = CFMetaData.inflate(SerDeUtils.<org.apache.cassandra.avro.CfDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
+            cfm = CFMetaData.inflate(SerDeUtils.<org.apache.cassandra.config.avro.CfDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
         }
         catch (ConfigurationException e)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddKeyspace.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddKeyspace.java?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddKeyspace.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/AddKeyspace.java Mon Aug  2
18:18:40 2010
@@ -19,7 +19,6 @@
 package org.apache.cassandra.db.migration;
 
 import org.apache.avro.Schema;
-import org.apache.avro.io.BinaryDecoder;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ConfigurationException;
@@ -51,7 +50,7 @@ public class AddKeyspace extends Migrati
         // deserialize ks
         try
         {
-            ksm = KSMetaData.inflate(SerDeUtils.<org.apache.cassandra.avro.KsDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
+            ksm = KSMetaData.inflate(SerDeUtils.<org.apache.cassandra.config.avro.KsDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
         }
         catch (ConfigurationException e)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java?rev=981645&r1=981644&r2=981645&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java Mon Aug  2 18:18:40
2010
@@ -227,7 +227,7 @@ public abstract class Migration
         rm.add(new QueryPath(SCHEMA_CF,
                              null,
                              DefsTable.DEFINITION_SCHEMA_COLUMN_NAME),
-                             org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8),
+                             org.apache.cassandra.config.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8),
                              now);
         return rm;
     }



Mime
View raw message