cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r981647 - in /cassandra/trunk/src/java/org/apache/cassandra: config/CFMetaData.java config/ColumnDefinition.java config/KSMetaData.java db/DefsTable.java db/migration/AddColumnFamily.java db/migration/AddKeyspace.java
Date Mon, 02 Aug 2010 18:18:56 GMT
Author: gdusbabek
Date: Mon Aug  2 18:18:55 2010
New Revision: 981647

URL: http://svn.apache.org/viewvc?rev=981647&view=rev
Log:
remove ConfigurationException from migration serialization. patch by stuhood, reviewed by
gdusbabek. CASSANDRA-1308

Modified:
    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

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=981647&r1=981646&r2=981647&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:55
2010
@@ -231,20 +231,21 @@ public final class CFMetaData
         return cf;
     }
 
-    public static CFMetaData inflate(org.apache.cassandra.config.avro.CfDef cf) throws ConfigurationException
+    public static CFMetaData inflate(org.apache.cassandra.config.avro.CfDef cf)
     {
-        AbstractType comparator = DatabaseDescriptor.getComparator(cf.comparator_type.toString());
+        AbstractType comparator;
         AbstractType subcolumnComparator = null;
-        if (cf.subcomparator_type != null)
-            subcolumnComparator = DatabaseDescriptor.getComparator(cf.subcomparator_type.toString());
-        AbstractReconciler reconciler = null;
+        AbstractReconciler reconciler;
         try
         {
+            comparator = DatabaseDescriptor.getComparator(cf.comparator_type.toString());
+            if (cf.subcomparator_type != null)
+                subcolumnComparator = DatabaseDescriptor.getComparator(cf.subcomparator_type.toString());
             reconciler = (AbstractReconciler)Class.forName(cf.reconciler.toString()).newInstance();
         }
         catch (Exception ex)
         {
-            throw new ConfigurationException("Could not create Reconciler of type " + cf.reconciler,
ex);
+            throw new RuntimeException("Could not inflate CFMetaData for " + cf, ex);
         }
         Map<byte[], ColumnDefinition> column_metadata = new TreeMap<byte[], ColumnDefinition>(FBUtilities.byteArrayComparator);
         Iterator<org.apache.cassandra.config.avro.ColumnDef> cditer = cf.column_metadata.iterator();

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=981647&r1=981646&r2=981647&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:55 2010
@@ -65,7 +65,7 @@ public class ColumnDefinition {
         return cd;
     }
 
-    public static ColumnDefinition inflate(org.apache.cassandra.config.avro.ColumnDef cd)
throws ConfigurationException
+    public static ColumnDefinition inflate(org.apache.cassandra.config.avro.ColumnDef cd)
     {
         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=981647&r1=981646&r2=981647&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:55
2010
@@ -92,7 +92,7 @@ public final class KSMetaData
         return ks;
     }
 
-    public static KSMetaData inflate(org.apache.cassandra.config.avro.KsDef ks) throws ConfigurationException
+    public static KSMetaData inflate(org.apache.cassandra.config.avro.KsDef ks)
     {
         Class<AbstractReplicationStrategy> repStratClass;
         try
@@ -101,7 +101,7 @@ public final class KSMetaData
         }
         catch (Exception ex)
         {
-            throw new ConfigurationException("Could not create ReplicationStrategy of type
" + ks.strategy_class, ex);
+            throw new RuntimeException("Could not create ReplicationStrategy of type " +
ks.strategy_class, ex);
         }
         Map<String, String> strategyOptions = null;
         if (ks.strategy_options != null)

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=981647&r1=981646&r2=981647&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:55 2010
@@ -102,19 +102,12 @@ public class DefsTable
 
         // deserialize keyspaces using schema
         Collection<KSMetaData> keyspaces = new ArrayList<KSMetaData>();
-        try
+        for (IColumn column : cf.getSortedColumns())
         {
-            for (IColumn column : cf.getSortedColumns())
-            {
-                if (Arrays.equals(column.name(), DEFINITION_SCHEMA_COLUMN_NAME))
-                    continue;
-                org.apache.cassandra.config.avro.KsDef ks = SerDeUtils.<org.apache.cassandra.config.avro.KsDef>deserialize(schema,
column.value());
-                keyspaces.add(KSMetaData.inflate(ks));
-            }
-        }
-        catch (ConfigurationException e)
-        {
-            throw new IOException(e);
+            if (Arrays.equals(column.name(), DEFINITION_SCHEMA_COLUMN_NAME))
+                continue;
+            org.apache.cassandra.config.avro.KsDef ks = SerDeUtils.<org.apache.cassandra.config.avro.KsDef>deserialize(schema,
column.value());
+            keyspaces.add(KSMetaData.inflate(ks));
         }
         return keyspaces;
     }

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=981647&r1=981646&r2=981647&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:55 2010
@@ -50,14 +50,7 @@ public class AddColumnFamily extends Mig
         rm = RowMutation.serializer().deserialize(din);
 
         // deserialize cf
-        try
-        {
-            cfm = CFMetaData.inflate(SerDeUtils.<org.apache.cassandra.config.avro.CfDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
-        }
-        catch (ConfigurationException e)
-        {
-            throw new IOException(e);
-        }
+        cfm = CFMetaData.inflate(SerDeUtils.<org.apache.cassandra.config.avro.CfDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
     }
     
     public AddColumnFamily(CFMetaData cfm) throws ConfigurationException, IOException

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=981647&r1=981646&r2=981647&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:55 2010
@@ -48,14 +48,7 @@ public class AddKeyspace extends Migrati
         rm = RowMutation.serializer().deserialize(din);
 
         // deserialize ks
-        try
-        {
-            ksm = KSMetaData.inflate(SerDeUtils.<org.apache.cassandra.config.avro.KsDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
-        }
-        catch (ConfigurationException e)
-        {
-            throw new IOException(e);
-        }
+        ksm = KSMetaData.inflate(SerDeUtils.<org.apache.cassandra.config.avro.KsDef>deserializeWithSchema(FBUtilities.readShortByteArray(din)));
     }
     
     public AddKeyspace(KSMetaData ksm) throws ConfigurationException, IOException



Mime
View raw message