cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1001943 - in /cassandra/trunk/src/java/org/apache/cassandra/config: CFMetaData.java DatabaseDescriptor.java KSMetaData.java
Date Mon, 27 Sep 2010 22:37:50 GMT
Author: jbellis
Date: Mon Sep 27 22:37:50 2010
New Revision: 1001943

URL: http://svn.apache.org/viewvc?rev=1001943&view=rev
Log:
fix reading beta1 schema from beta2.  patch by jhermes; reviewed by Stu Hood and jbellis for
CASSANDRA-1545

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.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=1001943&r1=1001942&r2=1001943&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Mon Sep 27 22:37:50
2010
@@ -370,6 +370,9 @@ public final class CFMetaData
             ColumnDefinition cd = ColumnDefinition.inflate(aColumn_metadata);
             column_metadata.put(cd.name, cd);
         }
+
+        Integer minct = cf.min_compaction_threshold == null ? DEFAULT_MIN_COMPACTION_THRESHOLD
: cf.min_compaction_threshold;
+        Integer maxct = cf.max_compaction_threshold == null ? DEFAULT_MAX_COMPACTION_THRESHOLD
: cf.max_compaction_threshold;
         return new CFMetaData(cf.keyspace.toString(),
                               cf.name.toString(),
                               ColumnFamilyType.create(cf.column_type.toString()),
@@ -384,8 +387,8 @@ public final class CFMetaData
                               cf.read_repair_chance,
                               cf.gc_grace_seconds,
                               validator,
-                              cf.min_compaction_threshold,
-                              cf.max_compaction_threshold,
+                              minct,
+                              maxct,
                               cf.id,
                               column_metadata);
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1001943&r1=1001942&r2=1001943&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Mon Sep 27
22:37:50 2010
@@ -505,9 +505,8 @@ public class DatabaseDescriptor
             {
                 throw new ConfigurationException("Missing replica_placement_strategy directive
for " + keyspace.name);
             }
-            String strategyClassName = keyspace.replica_placement_strategy.replace("RackUnawareStrategy",
"SimpleStrategy")
-                                                                          .replace("RackAwareStrategy",
"OldNetworkTopologyStrategy");
-            Class<AbstractReplicationStrategy> strategyClass = FBUtilities.<AbstractReplicationStrategy>classForName(strategyClassName,
"replication-strategy");
+            String strategyClassName = KSMetaData.convertOldStrategyName(keyspace.replica_placement_strategy);
+            Class<AbstractReplicationStrategy> strategyClass = FBUtilities.classForName(strategyClassName,
"replication-strategy");
             
             /* Data replication factor */
             if (keyspace.replication_factor == null)

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=1001943&r1=1001942&r2=1001943&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/KSMetaData.java Mon Sep 27 22:37:50
2010
@@ -96,7 +96,8 @@ public final class KSMetaData
         Class<AbstractReplicationStrategy> repStratClass;
         try
         {
-            repStratClass = (Class<AbstractReplicationStrategy>)Class.forName(ks.strategy_class.toString());
+            String strategyClassName = convertOldStrategyName(ks.strategy_class.toString());
+            repStratClass = (Class<AbstractReplicationStrategy>)Class.forName(strategyClassName);
         }
         catch (Exception ex)
         {
@@ -119,4 +120,11 @@ public final class KSMetaData
 
         return new KSMetaData(ks.name.toString(), repStratClass, strategyOptions, ks.replication_factor,
cfMetaData);
     }
+
+    public static String convertOldStrategyName(String name)
+    {
+        return name.replace("RackUnawareStrategy", "SimpleStrategy")
+                   .replace("RackAwareStrategy", "OldNetworkTopologyStrategy")
+                   .replace("DatacenterShardStrategy", "NetworkTopologyStrategy");
+    }
 }



Mime
View raw message