cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r979734 - in /cassandra/trunk/src/java/org/apache/cassandra: db/DefinitionsUpdateResponseVerbHandler.java service/StorageService.java
Date Tue, 27 Jul 2010 14:50:10 GMT
Author: gdusbabek
Date: Tue Jul 27 14:50:10 2010
New Revision: 979734

URL: http://svn.apache.org/viewvc?rev=979734&view=rev
Log:
push migrations when SS.loadSchemaFromYaml is called. patch by gdusbabek, reviewed by jbellis.
CASSANDRA-1321

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java?rev=979734&r1=979733&r2=979734&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java
Tue Jul 27 14:50:10 2010
@@ -60,8 +60,10 @@ public class DefinitionsUpdateResponseVe
                         protected void runMayThrow() throws Exception
                         {
                             // check to make sure the current version is before this one.
-                            if (DatabaseDescriptor.getDefsVersion().timestamp() >= version.timestamp())
-                                logger.debug("Not applying " + version.toString());
+                            if (DatabaseDescriptor.getDefsVersion().timestamp() == version.timestamp())
+                                logger.debug("Not appling (equal) " + version.toString());
+                            else if (DatabaseDescriptor.getDefsVersion().timestamp() >
version.timestamp())
+                                logger.debug("Not applying (before)" + version.toString());
                             else
                             {
                                 logger.debug("Applying {} from {}", m.getClass().getSimpleName(),
message.getFrom());

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=979734&r1=979733&r2=979734&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Tue Jul 27 14:50:10
2010
@@ -31,7 +31,6 @@ import javax.management.ObjectName;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ColumnDefinition;
-import org.apache.cassandra.config.Config;
 import org.apache.cassandra.config.RawColumnDefinition;
 import org.apache.cassandra.config.RawColumnFamily;
 import org.apache.cassandra.config.RawKeyspace;
@@ -77,10 +76,7 @@ import org.apache.log4j.Level;
 import org.yaml.snakeyaml.Dumper;
 import org.yaml.snakeyaml.DumperOptions;
 import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.introspector.Property;
-import org.yaml.snakeyaml.nodes.NodeTuple;
 import org.yaml.snakeyaml.nodes.Tag;
-import org.yaml.snakeyaml.representer.Representer;
 
 /*
  * This abstraction contains the token/identifier of this node
@@ -1667,8 +1663,13 @@ public class StorageService implements I
         // blow up if there is a schema saved.
         if (DatabaseDescriptor.getDefsVersion().timestamp() > 0 || Migration.getLastMigrationId()
!= null)
             throw new ConfigurationException("Cannot load from XML on top of pre-existing
schemas.");
+        
+        Migration migration = null;
         for (KSMetaData table : DatabaseDescriptor.readTablesFromYaml())
-            new AddKeyspace(table).apply();
+        {
+            migration = new AddKeyspace(table); 
+            migration.apply();
+        }
         
         assert DatabaseDescriptor.getDefsVersion().timestamp() > 0;
         DefsTable.dumpToStorage(DatabaseDescriptor.getDefsVersion());
@@ -1689,6 +1690,11 @@ public class StorageService implements I
             }
         }
         
+        // we don't want to announce after every Migration.apply(). keep track of the last
one and then announce the
+        // current version.
+        if (migration != null)
+            migration.announce();
+        
     }
 
     public String exportSchema() throws IOException



Mime
View raw message