Author: jbellis
Date: Mon Aug 15 20:45:38 2011
New Revision: 1158005

URL: http://svn.apache.org/viewvc?rev=1158005&view=rev
Log:
default auto_bootstrap to true and remove from example configuration
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-2477

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/service/LoadBroadcaster.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/CleanupTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/dht/BootStrapperTest.java
    
cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
    
cassandra/trunk/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java

Modified: 
cassandra/trunk/src/java/org/apache/cassandra/service/LoadBroadcaster.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/LoadBroadcaster.java?rev=1158005&r1=1158004&r2=1158005&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/LoadBroadcaster.java 
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/LoadBroadcaster.java 
Mon Aug 15 20:45:38 2011
@@ -85,23 +85,5 @@ public class LoadBroadcaster implements 
         };
         StorageService.scheduledTasks.scheduleWithFixedDelay(runnable, 2 * 
Gossiper.intervalInMillis, BROADCAST_INTERVAL, TimeUnit.MILLISECONDS);
     }
-
-    /**
-     * Wait for at least BROADCAST_INTERVAL ms, to give all nodes enough time 
to
-     * report in.
-     */
-    public void waitForLoadInfo()
-    {
-        int duration = BROADCAST_INTERVAL + StorageService.RING_DELAY;
-        try
-        {
-            logger_.info("Sleeping {} ms to wait for load information...", 
duration);
-            Thread.sleep(duration);
-        }
-        catch (InterruptedException e)
-        {
-            throw new AssertionError(e);
-        }
-    }
 }
 

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=1158005&r1=1158004&r2=1158005&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java 
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java 
Mon Aug 15 20:45:38 2011
@@ -367,7 +367,12 @@ public class StorageService implements I
         MigrationManager.passiveAnnounce(DatabaseDescriptor.getDefsVersion());
     }
 
-    public synchronized void initServer() throws IOException, 
org.apache.cassandra.config.ConfigurationException
+    public synchronized void initServer() throws IOException, 
ConfigurationException
+    {
+        initServer(RING_DELAY);
+    }
+
+    public synchronized void initServer(int delay) throws IOException, 
ConfigurationException
     {
         logger_.info("Cassandra version: " + 
FBUtilities.getReleaseVersionString());
         logger_.info("Thrift API version: " + Constants.VERSION);
@@ -431,7 +436,7 @@ public class StorageService implements I
 
         if (Boolean.parseBoolean(System.getProperty("cassandra.join_ring", 
"true")))
         {
-            joinTokenRing();
+            joinTokenRing(delay);
         }
         else
         {
@@ -439,7 +444,7 @@ public class StorageService implements I
         }
     }
 
-    private void joinTokenRing() throws IOException, 
org.apache.cassandra.config.ConfigurationException
+    private void joinTokenRing(int delay) throws IOException, 
org.apache.cassandra.config.ConfigurationException
     {
         logger_.info("Starting up server gossip");
         joined = true;
@@ -469,10 +474,17 @@ public class StorageService implements I
         if (DatabaseDescriptor.isAutoBootstrap()
             && 
!(DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress()) || 
SystemTable.isBootstrapped()))
         {
-            setMode("Joining: getting load and schema information", true);
-            LoadBroadcaster.instance.waitForLoadInfo();
+            setMode("Joining: waiting for ring and schema information", true);
+            try
+            {
+                Thread.sleep(delay);
+            }
+            catch (InterruptedException e)
+            {
+                throw new AssertionError(e);
+            }
             if (logger_.isDebugEnabled())
-                logger_.debug("... got load + schema info");
+                logger_.debug("... got ring + schema info");
             if (tokenMetadata_.isMember(FBUtilities.getBroadcastAddress()))
             {
                 String s = "This node is already a member of the token ring; 
bootstrap aborted. (If replacing a dead node, remove the old one from the ring 
first.)";
@@ -526,7 +538,7 @@ public class StorageService implements I
         if (!joined)
         {
             logger_.info("Joining ring by operator request");
-            joinTokenRing();
+            joinTokenRing(0);
         }
     }
 

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/CleanupTest.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/CleanupTest.java?rev=1158005&r1=1158004&r2=1158005&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/CleanupTest.java 
(original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/CleanupTest.java Mon Aug 
15 20:45:38 2011
@@ -67,7 +67,7 @@ public class CleanupTest extends Cleanup
     @Test
     public void testCleanup() throws IOException, ExecutionException, 
InterruptedException, ConfigurationException
     {
-        StorageService.instance.initServer();
+        StorageService.instance.initServer(0);
 
         Table table = Table.open(TABLE1);
         ColumnFamilyStore cfs = table.getColumnFamilyStore(CF2);

Modified: 
cassandra/trunk/test/unit/org/apache/cassandra/dht/BootStrapperTest.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/dht/BootStrapperTest.java?rev=1158005&r1=1158004&r2=1158005&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/dht/BootStrapperTest.java 
(original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/dht/BootStrapperTest.java 
Mon Aug 15 20:45:38 2011
@@ -46,7 +46,7 @@ public class BootStrapperTest extends Cl
     @Test
     public void testTokenRoundtrip() throws Exception
     {
-        StorageService.instance.initServer();
+        StorageService.instance.initServer(0);
         // fetch a bootstrap token from the local node
         assert 
BootStrapper.getBootstrapTokenFrom(FBUtilities.getBroadcastAddress()) != null;
     }

Modified: 
cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java?rev=1158005&r1=1158004&r2=1158005&view=diff
==============================================================================
--- 
cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
 (original)
+++ 
cassandra/trunk/test/unit/org/apache/cassandra/service/AntiEntropyServiceTestAbstract.java
 Mon Aug 15 20:45:38 2011
@@ -78,7 +78,7 @@ public abstract class AntiEntropyService
             init();
 
             LOCAL = FBUtilities.getBroadcastAddress();
-            StorageService.instance.initServer();
+            StorageService.instance.initServer(0);
             // generate a fake endpoint for which we can spoof 
receiving/sending trees
             REMOTE = InetAddress.getByName("127.0.0.2");
             store = null;

Modified: 
cassandra/trunk/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java?rev=1158005&r1=1158004&r2=1158005&view=diff
==============================================================================
--- 
cassandra/trunk/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
 (original)
+++ 
cassandra/trunk/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
 Mon Aug 15 20:45:38 2011
@@ -42,7 +42,7 @@ public class StorageServiceServerTest
     {
         CleanupHelper.mkdirs();
         CleanupHelper.cleanup();
-        StorageService.instance.initServer();
+        StorageService.instance.initServer(0);
         for (String path : DatabaseDescriptor.getAllDataFileLocations())
         {
             // verify that storage directories are there.


Reply via email to