cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1003079 - in /cassandra/trunk/src/java/org/apache/cassandra: db/SystemTable.java service/StorageService.java
Date Thu, 30 Sep 2010 14:34:12 GMT
Author: jbellis
Date: Thu Sep 30 14:34:11 2010
New Revision: 1003079

URL: http://svn.apache.org/viewvc?rev=1003079&view=rev
Log:
fixes for SystemTable token change.  patch by jbellis

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

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java?rev=1003079&r1=1003078&r2=1003079&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java Thu Sep 30 14:34:11
2010
@@ -36,6 +36,7 @@ import org.apache.cassandra.config.CFMet
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.clock.TimestampReconciler;
+import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.marshal.BytesType;
@@ -122,6 +123,19 @@ public class SystemTable
         {
             throw new IOError(e);
         }
+
+        try
+        {
+            Table.open(Table.SYSTEM_TABLE).getColumnFamilyStore(SystemTable.STATUS_CF).forceBlockingFlush();
+        }
+        catch (ExecutionException e)
+        {
+            throw new RuntimeException(e);
+        }
+        catch (InterruptedException e)
+        {
+            throw new AssertionError(e);
+        }
     }
 
     /**
@@ -186,7 +200,7 @@ public class SystemTable
         assert clusterCol != null;
         if (!DatabaseDescriptor.getPartitioner().getClass().getName().equals(new String(partitionerCol.value(),
UTF_8)))
             throw new ConfigurationException("Detected partitioner mismatch! Did you change
the partitioner?");
-        if (!DatabaseDescriptor.getClusterName().equals(new String(clusterCol.value())));
+        if (!DatabaseDescriptor.getClusterName().equals(new String(clusterCol.value())))
             throw new ConfigurationException("Saved cluster name " + new String(clusterCol.value())
+ " != configured name " + DatabaseDescriptor.getClusterName());
     }
 
@@ -201,7 +215,7 @@ public class SystemTable
     public static int incrementAndGetGeneration() throws IOException
     {
         Table table = Table.open(Table.SYSTEM_TABLE);
-        QueryFilter filter = QueryFilter.getNamesFilter(decorate(LOCATION_KEY), new QueryPath(STATUS_CF),
TOKEN);
+        QueryFilter filter = QueryFilter.getNamesFilter(decorate(LOCATION_KEY), new QueryPath(STATUS_CF),
GENERATION);
         ColumnFamily cf = table.getColumnFamilyStore(STATUS_CF).getColumnFamily(filter);
 
         int generation;

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=1003079&r1=1003078&r2=1003079&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Thu Sep 30 14:34:11
2010
@@ -420,10 +420,14 @@ public class StorageService implements I
                 else
                 {
                     token = partitioner_.getTokenFactory().fromString(initialToken);
-                    logger_.info("Saved Token not found. Using " + token + " from configuration");
+                    logger_.info("Saved token not found. Using " + token + " from configuration");
                 }
                 SystemTable.updateToken(token);
             }
+            else
+            {
+                logger_.info("Using saved token " + token);
+            }
             SystemTable.setBootstrapped(true);
             tokenMetadata_.updateNormalToken(token, FBUtilities.getLocalAddress());
             Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.normal(token));



Mime
View raw message