cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject svn commit: r1044034 - in /cassandra: branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java trunk/src/java/org/apache/cassandra/service/StorageService.java
Date Thu, 09 Dec 2010 16:57:43 GMT
Author: brandonwilliams
Date: Thu Dec  9 16:57:42 2010
New Revision: 1044034

URL: http://svn.apache.org/viewvc?rev=1044034&view=rev
Log:
Restore finishBootstrapping behavior to fix nodetool move.  Patch by Nick Bailey, reviewed
by brandonwilliams for CASSANDRA-1829

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java?rev=1044034&r1=1044033&r2=1044034&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/StorageService.java
Thu Dec  9 16:57:42 2010
@@ -246,6 +246,7 @@ public class StorageService implements I
     public void finishBootstrapping()
     {
         isBootstrapMode = false;
+        setToken(getLocalToken());
         logger_.info("Bootstrap/move completed! Now serving reads.");
     }
 
@@ -256,6 +257,8 @@ public class StorageService implements I
             logger_.debug("Setting token to {}", token);
         SystemTable.updateToken(token);
         tokenMetadata_.updateNormalToken(token, FBUtilities.getLocalAddress());
+        Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.normal(getLocalToken()));
+        setMode("Normal", false);
     }
 
     public StorageService()
@@ -395,6 +398,7 @@ public class StorageService implements I
             logger_.info("This node will not auto bootstrap because it is configured to be
a seed node.");
 
         Token token;
+        boolean bootstrapped = false;
         if (DatabaseDescriptor.isAutoBootstrap()
             && !(DatabaseDescriptor.getSeeds().contains(FBUtilities.getLocalAddress())
|| SystemTable.isBootstrapped()))
         {
@@ -414,6 +418,8 @@ public class StorageService implements I
             {
                 bootstrap(token);
                 assert !isBootstrapMode; // bootstrap will block until finished
+                bootstrapped = true;
+                SystemTable.setBootstrapped(true); // first startup is only chance to bootstrap
             }
             // else nothing to do, go directly to participating in ring
         }
@@ -440,10 +446,8 @@ public class StorageService implements I
             }
         } 
 
-        SystemTable.setBootstrapped(true); // first startup is only chance to bootstrap
-        setToken(token);
-        Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.normal(getLocalToken()));
-        setMode("Normal", false);
+        if(!bootstrapped)
+            setToken(token);
 
         assert tokenMetadata_.sortedTokens().size() > 0;
     }

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=1044034&r1=1044033&r2=1044034&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Thu Dec  9 16:57:42
2010
@@ -246,6 +246,7 @@ public class StorageService implements I
     public void finishBootstrapping()
     {
         isBootstrapMode = false;
+        setToken(getLocalToken());
         logger_.info("Bootstrap/move completed! Now serving reads.");
     }
 
@@ -256,6 +257,8 @@ public class StorageService implements I
             logger_.debug("Setting token to {}", token);
         SystemTable.updateToken(token);
         tokenMetadata_.updateNormalToken(token, FBUtilities.getLocalAddress());
+        Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.normal(getLocalToken()));
+        setMode("Normal", false);
     }
 
     public StorageService()
@@ -395,6 +398,7 @@ public class StorageService implements I
             logger_.info("This node will not auto bootstrap because it is configured to be
a seed node.");
 
         Token token;
+        boolean bootstrapped = false;
         if (DatabaseDescriptor.isAutoBootstrap()
             && !(DatabaseDescriptor.getSeeds().contains(FBUtilities.getLocalAddress())
|| SystemTable.isBootstrapped()))
         {
@@ -414,6 +418,8 @@ public class StorageService implements I
             {
                 bootstrap(token);
                 assert !isBootstrapMode; // bootstrap will block until finished
+                bootstrapped = true;
+                SystemTable.setBootstrapped(true); // first startup is only chance to bootstrap
             }
             // else nothing to do, go directly to participating in ring
         }
@@ -440,10 +446,8 @@ public class StorageService implements I
             }
         } 
 
-        SystemTable.setBootstrapped(true); // first startup is only chance to bootstrap
-        setToken(token);
-        Gossiper.instance.addLocalApplicationState(ApplicationState.STATUS, valueFactory.normal(getLocalToken()));
-        setMode("Normal", false);
+        if(!bootstrapped)
+            setToken(token);
 
         assert tokenMetadata_.sortedTokens().size() > 0;
     }



Mime
View raw message