cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r1060583 - in /cassandra/trunk: src/avro/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/migration/ src/java/org/apache/cassandra/io/ test/unit/org/apache/cassandra/config/ test/unit...
Date Tue, 18 Jan 2011 21:26:45 GMT
Author: gdusbabek
Date: Tue Jan 18 21:26:44 2011
New Revision: 1060583

URL: http://svn.apache.org/viewvc?rev=1060583&view=rev
Log:
back out of 2001. patch by gdusbabek. CASSANDRA-2001

Modified:
    cassandra/trunk/src/avro/internode.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/Migration.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateColumnFamily.java
    cassandra/trunk/src/java/org/apache/cassandra/io/SerDeUtils.java
    cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java

Modified: cassandra/trunk/src/avro/internode.genavro
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/avro/internode.genavro?rev=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/src/avro/internode.genavro (original)
+++ cassandra/trunk/src/avro/internode.genavro Tue Jan 18 21:26:44 2011
@@ -23,13 +23,13 @@
 
 protocol InterNode {
     @aliases(["org.apache.cassandra.config.avro.IndexType"])
-    @namespace("org.apache.cassandra.avro")
+    @namespace("org.apache.cassandra.db.migration.avro")
     enum IndexType {
         KEYS
     }
 
     @aliases(["org.apache.cassandra.config.avro.ColumnDef"])
-    @namespace("org.apache.cassandra.avro")
+    @namespace("org.apache.cassandra.db.migration.avro")
     record ColumnDef {
         bytes name;
         string validation_class;
@@ -38,9 +38,8 @@ protocol InterNode {
     }
 
     @aliases(["org.apache.cassandra.config.avro.CfDef"])
-    @namespace("org.apache.cassandra.avro")
+    @namespace("org.apache.cassandra.db.migration.avro")
     record CfDef {
-        /* order is important. */
         string keyspace;
         string name;
         union { string, null } column_type;
@@ -50,6 +49,7 @@ protocol InterNode {
         union { double, null } row_cache_size;
         union { double, null } key_cache_size;
         union { double, null } read_repair_chance;
+        union { boolean, null } replicate_on_write;
         union { int, null } gc_grace_seconds;
         union { null, string } default_validation_class = null;
         union { null, int } min_compaction_threshold = null;
@@ -61,11 +61,10 @@ protocol InterNode {
         union { null, double} memtable_operations_in_millions = null;
         union { int, null } id;
         union { array<ColumnDef>, null } column_metadata;
-        union { boolean, null } replicate_on_write;
     }
 
     @aliases(["org.apache.cassandra.config.avro.KsDef"])
-    @namespace("org.apache.cassandra.avro")
+    @namespace("org.apache.cassandra.db.migration.avro")
     record KsDef {
         string name;
         string strategy_class;
@@ -79,12 +78,12 @@ protocol InterNode {
 
     @namespace("org.apache.cassandra.db.migration.avro")
     record AddColumnFamily {
-        org.apache.cassandra.avro.CfDef cf;
+        CfDef cf;
     }
 
     @namespace("org.apache.cassandra.db.migration.avro")
     record AddKeyspace {
-        org.apache.cassandra.avro.KsDef ks;
+        KsDef ks;
     }
 
     @namespace("org.apache.cassandra.db.migration.avro")
@@ -114,13 +113,13 @@ protocol InterNode {
     
     @namespace("org.apache.cassandra.db.migration.avro")
     record UpdateKeyspace {
-        org.apache.cassandra.avro.KsDef oldKs;
-        org.apache.cassandra.avro.KsDef newKs;
+        KsDef oldKs;
+        KsDef newKs;
     }
     
     @namespace("org.apache.cassandra.db.migration.avro")
     record UpdateColumnFamily {
-        org.apache.cassandra.avro.CfDef metadata;
+        CfDef metadata;
     }
 
     @namespace("org.apache.cassandra.db.migration.avro")

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=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Tue Jan 18 21:26:44
2011
@@ -29,7 +29,7 @@ import org.apache.commons.lang.builder.H
 import org.apache.commons.lang.builder.ToStringBuilder;
 
 import org.apache.avro.util.Utf8;
-import org.apache.cassandra.avro.ColumnDef;
+import org.apache.cassandra.db.migration.avro.ColumnDef;
 import org.apache.cassandra.db.ColumnFamilyType;
 import org.apache.cassandra.db.HintedHandOffManager;
 import org.apache.cassandra.db.SystemTable;
@@ -363,9 +363,9 @@ public final class CFMetaData
         return parentCf + "." + (info.getIndexName() == null ? FBUtilities.bytesToHex(info.name)
: info.getIndexName());
     }
 
-    public org.apache.cassandra.avro.CfDef deflate()
+    public org.apache.cassandra.db.migration.avro.CfDef deflate()
     {
-        org.apache.cassandra.avro.CfDef cf = new org.apache.cassandra.avro.CfDef();
+        org.apache.cassandra.db.migration.avro.CfDef cf = new org.apache.cassandra.db.migration.avro.CfDef();
         cf.id = cfId;
         cf.keyspace = new Utf8(tableName);
         cf.name = new Utf8(cfName);
@@ -388,13 +388,13 @@ public final class CFMetaData
         cf.memtable_throughput_in_mb = memtableThroughputInMb;
         cf.memtable_operations_in_millions = memtableOperationsInMillions;
         cf.column_metadata = SerDeUtils.createArray(column_metadata.size(),
-                                                    org.apache.cassandra.avro.ColumnDef.SCHEMA$);
+                                                    org.apache.cassandra.db.migration.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)
+    public static CFMetaData inflate(org.apache.cassandra.db.migration.avro.CfDef cf)
     {
         AbstractType comparator;
         AbstractType subcolumnComparator = null;
@@ -413,7 +413,7 @@ public final class CFMetaData
             throw new RuntimeException("Could not inflate CFMetaData for " + cf, ex);
         }
         Map<ByteBuffer, ColumnDefinition> column_metadata = new TreeMap<ByteBuffer,
ColumnDefinition>(BytesType.instance);
-        for (org.apache.cassandra.avro.ColumnDef aColumn_metadata : cf.column_metadata)
+        for (ColumnDef aColumn_metadata : cf.column_metadata)
         {
             ColumnDefinition cd = ColumnDefinition.inflate(aColumn_metadata);
             column_metadata.put(cd.name, cd);
@@ -427,7 +427,6 @@ public final class CFMetaData
         Integer memtable_flush_after_mins = cf.memtable_flush_after_mins == null ? DEFAULT_MEMTABLE_LIFETIME_IN_MINS
: cf.memtable_flush_after_mins;
         Integer memtable_throughput_in_mb = cf.memtable_throughput_in_mb == null ? DEFAULT_MEMTABLE_THROUGHPUT_IN_MB
: cf.memtable_throughput_in_mb;
         Double memtable_operations_in_millions = cf.memtable_operations_in_millions == null
? DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS : cf.memtable_operations_in_millions;
-        Boolean replicate_on_write = cf.replicate_on_write == null ? Boolean.FALSE : cf.replicate_on_write;
 
         return new CFMetaData(cf.keyspace.toString(),
                               cf.name.toString(),
@@ -438,7 +437,7 @@ public final class CFMetaData
                               cf.row_cache_size,
                               cf.key_cache_size,
                               cf.read_repair_chance,
-                              replicate_on_write,
+                              cf.replicate_on_write,
                               cf.gc_grace_seconds,
                               validator,
                               minct,
@@ -605,7 +604,7 @@ public final class CFMetaData
     }
     
     /** applies implicit defaults to cf definition. useful in updates */
-    public static void applyImplicitDefaults(org.apache.cassandra.avro.CfDef cf_def)
+    public static void applyImplicitDefaults(org.apache.cassandra.db.migration.avro.CfDef
cf_def)
     {
         if (cf_def.min_compaction_threshold == null)
             cf_def.min_compaction_threshold = CFMetaData.DEFAULT_MIN_COMPACTION_THRESHOLD;
@@ -643,7 +642,7 @@ public final class CFMetaData
     }
     
     // merges some final fields from this CFM with modifiable fields from CfDef into a new
CFMetaData.
-    public void apply(org.apache.cassandra.avro.CfDef cf_def) throws ConfigurationException
+    public void apply(org.apache.cassandra.db.migration.avro.CfDef cf_def) throws ConfigurationException
     {
         // validate
         if (!cf_def.id.equals(cfId))
@@ -686,8 +685,8 @@ public final class CFMetaData
         // adjust secondary indexes. figure out who is coming and going.
         Set<ByteBuffer> toRemove = new HashSet<ByteBuffer>();
         Set<ByteBuffer> newIndexNames = new HashSet<ByteBuffer>();
-        Set<org.apache.cassandra.avro.ColumnDef> toAdd = new HashSet<org.apache.cassandra.avro.ColumnDef>();
-        for (org.apache.cassandra.avro.ColumnDef def : cf_def.column_metadata)
+        Set<org.apache.cassandra.db.migration.avro.ColumnDef> toAdd = new HashSet<org.apache.cassandra.db.migration.avro.ColumnDef>();
+        for (org.apache.cassandra.db.migration.avro.ColumnDef def : cf_def.column_metadata)
         {
             newIndexNames.add(def.name);
             if (!column_metadata.containsKey(def.name))
@@ -701,7 +700,7 @@ public final class CFMetaData
         for (ByteBuffer indexName : toRemove)
             column_metadata.remove(indexName);
         // update the ones staying
-        for (org.apache.cassandra.avro.ColumnDef def : cf_def.column_metadata)
+        for (org.apache.cassandra.db.migration.avro.ColumnDef def : cf_def.column_metadata)
         {
             if (!column_metadata.containsKey(def.name))
                 continue;
@@ -709,7 +708,7 @@ public final class CFMetaData
             column_metadata.get(def.name).setIndexName(def.index_name == null ? null : def.index_name.toString());
         }
         // add the new ones coming in.
-        for (org.apache.cassandra.avro.ColumnDef def : toAdd)
+        for (org.apache.cassandra.db.migration.avro.ColumnDef def : toAdd)
         {
             ColumnDefinition cd = new ColumnDefinition(def.name, 
                                                        def.validation_class.toString(), 
@@ -760,9 +759,9 @@ public final class CFMetaData
     }
     
     // converts CFM to avro CfDef
-    public static org.apache.cassandra.avro.CfDef convertToAvro(CFMetaData cfm)
+    public static org.apache.cassandra.db.migration.avro.CfDef convertToAvro(CFMetaData cfm)
     {
-        org.apache.cassandra.avro.CfDef def = new org.apache.cassandra.avro.CfDef();
+        org.apache.cassandra.db.migration.avro.CfDef def = new org.apache.cassandra.db.migration.avro.CfDef();
         def.name = cfm.cfName;
         def.keyspace = cfm.tableName;
         def.id = cfm.cfId;
@@ -787,12 +786,12 @@ public final class CFMetaData
         def.memtable_flush_after_mins = cfm.memtableFlushAfterMins;
         def.memtable_throughput_in_mb = cfm.memtableThroughputInMb;
         def.memtable_operations_in_millions = cfm.memtableOperationsInMillions;
-        List<org.apache.cassandra.avro.ColumnDef> column_meta = new ArrayList<org.apache.cassandra.avro.ColumnDef>(cfm.column_metadata.size());
+        List<org.apache.cassandra.db.migration.avro.ColumnDef> column_meta = new ArrayList<org.apache.cassandra.db.migration.avro.ColumnDef>(cfm.column_metadata.size());
         for (ColumnDefinition cd : cfm.column_metadata.values())
         {
-            org.apache.cassandra.avro.ColumnDef tcd = new org.apache.cassandra.avro.ColumnDef();
+            org.apache.cassandra.db.migration.avro.ColumnDef tcd = new org.apache.cassandra.db.migration.avro.ColumnDef();
             tcd.index_name = cd.getIndexName();
-            tcd.index_type = cd.getIndexType() == null ? null : org.apache.cassandra.avro.IndexType.valueOf(cd.getIndexType().name());
+            tcd.index_type = cd.getIndexType() == null ? null : org.apache.cassandra.db.migration.avro.IndexType.valueOf(cd.getIndexType().name());
             tcd.name = ByteBufferUtil.clone(cd.name);
             tcd.validation_class = cd.validator.getClass().getName();
             column_meta.add(tcd);
@@ -801,9 +800,9 @@ public final class CFMetaData
         return def;
     }
     
-    public static org.apache.cassandra.avro.CfDef convertToAvro(org.apache.cassandra.thrift.CfDef
def)
+    public static org.apache.cassandra.db.migration.avro.CfDef convertToAvro(org.apache.cassandra.thrift.CfDef
def)
     {
-        org.apache.cassandra.avro.CfDef newDef = new org.apache.cassandra.avro.CfDef();
+        org.apache.cassandra.db.migration.avro.CfDef newDef = new org.apache.cassandra.db.migration.avro.CfDef();
         newDef.keyspace = def.getKeyspace();
         newDef.name = def.getName();
         newDef.column_type = def.getColumn_type();
@@ -825,14 +824,14 @@ public final class CFMetaData
         newDef.row_cache_size = def.getRow_cache_size();
         newDef.subcomparator_type = def.getSubcomparator_type();
         
-        List<org.apache.cassandra.avro.ColumnDef> columnMeta = new ArrayList<org.apache.cassandra.avro.ColumnDef>();
+        List<org.apache.cassandra.db.migration.avro.ColumnDef> columnMeta = new ArrayList<org.apache.cassandra.db.migration.avro.ColumnDef>();
         for (org.apache.cassandra.thrift.ColumnDef cdef : def.getColumn_metadata())
         {
-            org.apache.cassandra.avro.ColumnDef tdef = new org.apache.cassandra.avro.ColumnDef();
+            org.apache.cassandra.db.migration.avro.ColumnDef tdef = new org.apache.cassandra.db.migration.avro.ColumnDef();
             tdef.name = ByteBufferUtil.clone(cdef.BufferForName());
             tdef.validation_class = cdef.getValidation_class();
             tdef.index_name = cdef.getIndex_name();
-            tdef.index_type = cdef.getIndex_type() == null ? null : org.apache.cassandra.avro.IndexType.valueOf(cdef.getIndex_type().name());
+            tdef.index_type = cdef.getIndex_type() == null ? null : org.apache.cassandra.db.migration.avro.IndexType.valueOf(cdef.getIndex_type().name());
             columnMeta.add(tdef);
         }
         newDef.column_metadata = columnMeta;
@@ -869,7 +868,7 @@ public final class CFMetaData
         }
     }
 
-    public static void validateMinMaxCompactionThresholds(org.apache.cassandra.avro.CfDef
cf_def) throws ConfigurationException
+    public static void validateMinMaxCompactionThresholds(org.apache.cassandra.db.migration.avro.CfDef
cf_def) throws ConfigurationException
     {
         if (cf_def.min_compaction_threshold != null && cf_def.max_compaction_threshold
!= null)
         {
@@ -912,7 +911,7 @@ public final class CFMetaData
         }
     }
 
-    public static void validateMemtableSettings(org.apache.cassandra.avro.CfDef cf_def) throws
ConfigurationException
+    public static void validateMemtableSettings(org.apache.cassandra.db.migration.avro.CfDef
cf_def) throws ConfigurationException
     {
         if (cf_def.memtable_flush_after_mins != null && cf_def.memtable_flush_after_mins
<= 0) {
             throw new ConfigurationException("memtable_flush_after_mins cannot be non-positive");

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=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/ColumnDefinition.java Tue Jan 18
21:26:44 2011
@@ -79,18 +79,18 @@ public class ColumnDefinition
         return result;
     }
 
-    public org.apache.cassandra.avro.ColumnDef deflate()
+    public org.apache.cassandra.db.migration.avro.ColumnDef deflate()
     {
-        org.apache.cassandra.avro.ColumnDef cd = new org.apache.cassandra.avro.ColumnDef();
+        org.apache.cassandra.db.migration.avro.ColumnDef cd = new org.apache.cassandra.db.migration.avro.ColumnDef();
         cd.name = 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.db.migration.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)
+    public static ColumnDefinition inflate(org.apache.cassandra.db.migration.avro.ColumnDef
cd)
     {
         IndexType index_type = cd.index_type == null ? null :
             Enum.valueOf(IndexType.class, cd.index_type.name());
@@ -110,7 +110,7 @@ public class ColumnDefinition
         return new ColumnDefinition(ByteBufferUtil.clone(thriftColumnDef.name), thriftColumnDef.validation_class,
thriftColumnDef.index_type, thriftColumnDef.index_name);
     }
     
-    public static ColumnDefinition fromColumnDef(org.apache.cassandra.avro.ColumnDef avroColumnDef)
throws ConfigurationException
+    public static ColumnDefinition fromColumnDef(org.apache.cassandra.db.migration.avro.ColumnDef
avroColumnDef) throws ConfigurationException
     {
         validateIndexType(avroColumnDef);
         return new ColumnDefinition(avroColumnDef.name,
@@ -131,13 +131,13 @@ public class ColumnDefinition
         return Collections.unmodifiableMap(cds);
     }
     
-    public static Map<ByteBuffer, ColumnDefinition> fromColumnDefs(Iterable<org.apache.cassandra.avro.ColumnDef>
avroDefs) throws ConfigurationException
+    public static Map<ByteBuffer, ColumnDefinition> fromColumnDefs(Iterable<org.apache.cassandra.db.migration.avro.ColumnDef>
avroDefs) throws ConfigurationException
     {
         if (avroDefs == null)
             return Collections.emptyMap();
 
         Map<ByteBuffer, ColumnDefinition> cds = new TreeMap<ByteBuffer, ColumnDefinition>();
-        for (org.apache.cassandra.avro.ColumnDef avroColumnDef : avroDefs)
+        for (org.apache.cassandra.db.migration.avro.ColumnDef avroColumnDef : avroDefs)
         {
             validateIndexType(avroColumnDef);
             cds.put(avroColumnDef.name, fromColumnDef(avroColumnDef));
@@ -146,7 +146,7 @@ public class ColumnDefinition
         return Collections.unmodifiableMap(cds);
     }
 
-    public static void validateIndexType(org.apache.cassandra.avro.ColumnDef avroColumnDef)
throws ConfigurationException
+    public static void validateIndexType(org.apache.cassandra.db.migration.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");

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=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java Tue Jan 18 21:26:44
2011
@@ -73,9 +73,9 @@ public final class KSMetaData
         return cfMetaData;
     }
         
-    public org.apache.cassandra.avro.KsDef deflate()
+    public org.apache.cassandra.db.migration.avro.KsDef deflate()
     {
-        org.apache.cassandra.avro.KsDef ks = new org.apache.cassandra.avro.KsDef();
+        org.apache.cassandra.db.migration.avro.KsDef ks = new org.apache.cassandra.db.migration.avro.KsDef();
         ks.name = new Utf8(name);
         ks.strategy_class = new Utf8(strategyClass.getName());
         if (strategyOptions != null)
@@ -87,13 +87,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.db.migration.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)
+    public static KSMetaData inflate(org.apache.cassandra.db.migration.avro.KsDef ks)
     {
         Class<AbstractReplicationStrategy> repStratClass;
         try
@@ -116,7 +116,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.db.migration.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=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DefsTable.java Tue Jan 18 21:26:44 2011
@@ -63,7 +63,7 @@ public class DefsTable
         rm.add(new QueryPath(Migration.SCHEMA_CF,
                              null,
                              DEFINITION_SCHEMA_COLUMN_NAME),
-                             ByteBuffer.wrap(org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8)),
+                             ByteBuffer.wrap(org.apache.cassandra.db.migration.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8)),
                              now);
         rm.apply();
 
@@ -97,7 +97,7 @@ public class DefsTable
         {
             if (column.name().equals(DEFINITION_SCHEMA_COLUMN_NAME))
                 continue;
-            org.apache.cassandra.avro.KsDef ks = SerDeUtils.deserialize(schema, column.value(),
new org.apache.cassandra.avro.KsDef());
+            org.apache.cassandra.db.migration.avro.KsDef ks = SerDeUtils.deserialize(schema,
column.value(), new org.apache.cassandra.db.migration.avro.KsDef());
             keyspaces.add(KSMetaData.inflate(ks));
         }
         return keyspaces;

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=1060583&r1=1060582&r2=1060583&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 Tue Jan 18 21:26:44
2011
@@ -234,7 +234,7 @@ public abstract class Migration
         rm.add(new QueryPath(SCHEMA_CF,
                              null,
                              DefsTable.DEFINITION_SCHEMA_COLUMN_NAME),
-                             ByteBuffer.wrap(org.apache.cassandra.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8)),
+                             ByteBuffer.wrap(org.apache.cassandra.db.migration.avro.KsDef.SCHEMA$.toString().getBytes(UTF_8)),
                              now);
         return rm;
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateColumnFamily.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateColumnFamily.java?rev=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateColumnFamily.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/UpdateColumnFamily.java Tue
Jan 18 21:26:44 2011
@@ -38,7 +38,7 @@ public class UpdateColumnFamily extends 
     protected UpdateColumnFamily() { }
     
     /** assumes validation has already happened. That is, replacing oldCfm with newCfm is
neither illegal or totally whackass. */
-    public UpdateColumnFamily(org.apache.cassandra.avro.CfDef cf_def) throws ConfigurationException,
IOException
+    public UpdateColumnFamily(org.apache.cassandra.db.migration.avro.CfDef cf_def) throws
ConfigurationException, IOException
     {
         super(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress()), DatabaseDescriptor.getDefsVersion());
         

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/SerDeUtils.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/SerDeUtils.java?rev=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/SerDeUtils.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/SerDeUtils.java Tue Jan 18 21:26:44 2011
@@ -64,8 +64,7 @@ public final class SerDeUtils
     {
         BinaryDecoder dec = DIRECT_DECODERS.createBinaryDecoder(ByteBufferUtil.getArray(bytes),
null);
         SpecificDatumReader<T> reader = new SpecificDatumReader<T>(writer);
-        // we're expecting to see the schema of the writer, not the current schema, aka ob.getSchema().
-        reader.setExpected(writer);
+        reader.setExpected(ob.getSchema());
         return reader.read(ob, dec);
     }
 

Modified: cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java?rev=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/config/DatabaseDescriptorTest.java Tue
Jan 18 21:26:44 2011
@@ -51,7 +51,7 @@ public class DatabaseDescriptorTest
         {
             for (CFMetaData cfm : DatabaseDescriptor.getTableMetaData(table).values())
             {
-                CFMetaData cfmDupe = CFMetaData.inflate(serDe(cfm.deflate(), new org.apache.cassandra.avro.CfDef()));
+                CFMetaData cfmDupe = CFMetaData.inflate(serDe(cfm.deflate(), new org.apache.cassandra.db.migration.avro.CfDef()));
                 assert cfmDupe != null;
                 assert cfmDupe.equals(cfm);
             }
@@ -63,7 +63,7 @@ public class DatabaseDescriptorTest
     {
         for (KSMetaData ksm : DatabaseDescriptor.tables.values())
         {
-            KSMetaData ksmDupe = KSMetaData.inflate(serDe(ksm.deflate(), new org.apache.cassandra.avro.KsDef()));
+            KSMetaData ksmDupe = KSMetaData.inflate(serDe(ksm.deflate(), new org.apache.cassandra.db.migration.avro.KsDef()));
             assert ksmDupe != null;
             assert ksmDupe.equals(ksm);
         }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java?rev=1060583&r1=1060582&r2=1060583&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java Tue Jan 18 21:26:44 2011
@@ -70,12 +70,12 @@ public class DefsTest extends CleanupHel
     @Test
     public void testZeroInjection() throws IOException
     {
-        org.apache.cassandra.avro.CfDef cd = new org.apache.cassandra.avro.CfDef();
+        org.apache.cassandra.db.migration.avro.CfDef cd = new org.apache.cassandra.db.migration.avro.CfDef();
         // populate only fields that must be non-null.
         cd.keyspace = new Utf8("Lest Ks");
         cd.name = new Utf8("Mest Cf");
         
-        org.apache.cassandra.avro.CfDef cd2 = SerDeUtils.deserializeWithSchema(SerDeUtils.serializeWithSchema(cd),
new org.apache.cassandra.avro.CfDef());
+        org.apache.cassandra.db.migration.avro.CfDef cd2 = SerDeUtils.deserializeWithSchema(SerDeUtils.serializeWithSchema(cd),
new org.apache.cassandra.db.migration.avro.CfDef());
         assert cd.equals(cd2);
         // make sure some of the fields didn't get unexpected zeros put in during [de]serialize
operations.
         assert cd.min_compaction_threshold == null;
@@ -126,20 +126,20 @@ public class DefsTest extends CleanupHel
         
         // we'll be adding this one later. make sure it's not already there.
         assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 5 })) == null;
-        org.apache.cassandra.avro.CfDef cfDef = CFMetaData.convertToAvro(cfm);
+        org.apache.cassandra.db.migration.avro.CfDef cfDef = CFMetaData.convertToAvro(cfm);
         
         // add one.
-        org.apache.cassandra.avro.ColumnDef addIndexDef = new org.apache.cassandra.avro.ColumnDef();
+        org.apache.cassandra.db.migration.avro.ColumnDef addIndexDef = new org.apache.cassandra.db.migration.avro.ColumnDef();
         addIndexDef.index_name = "5";
-        addIndexDef.index_type = org.apache.cassandra.avro.IndexType.KEYS;
+        addIndexDef.index_type = org.apache.cassandra.db.migration.avro.IndexType.KEYS;
         addIndexDef.name = ByteBuffer.wrap(new byte[] { 5 });
         addIndexDef.validation_class = BytesType.class.getName();
         cfDef.column_metadata.add(addIndexDef);
         
         // remove one.
-        org.apache.cassandra.avro.ColumnDef removeIndexDef = new org.apache.cassandra.avro.ColumnDef();
+        org.apache.cassandra.db.migration.avro.ColumnDef removeIndexDef = new org.apache.cassandra.db.migration.avro.ColumnDef();
         removeIndexDef.index_name = "0";
-        removeIndexDef.index_type = org.apache.cassandra.avro.IndexType.KEYS;
+        removeIndexDef.index_type = org.apache.cassandra.db.migration.avro.IndexType.KEYS;
         removeIndexDef.name = ByteBuffer.wrap(new byte[] { 0 });
         removeIndexDef.validation_class = BytesType.class.getName();
         assert cfDef.column_metadata.remove(removeIndexDef);
@@ -627,9 +627,9 @@ public class DefsTest extends CleanupHel
         assert DatabaseDescriptor.getCFMetaData(cf.tableName, cf.cfName) != null;
         
         // updating certain fields should fail.
-        org.apache.cassandra.avro.CfDef cf_def = CFMetaData.convertToAvro(cf);
+        org.apache.cassandra.db.migration.avro.CfDef cf_def = CFMetaData.convertToAvro(cf);
         cf_def.row_cache_size = 43.3;
-        cf_def.column_metadata = new ArrayList<org.apache.cassandra.avro.ColumnDef>();
+        cf_def.column_metadata = new ArrayList<org.apache.cassandra.db.migration.avro.ColumnDef>();
         cf_def.default_validation_class ="BytesType";
         cf_def.min_compaction_threshold = 5;
         cf_def.max_compaction_threshold = 31;



Mime
View raw message