cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [12/13] git commit: Cleanup from 5025, allow recovering nodes to pull immediately
Date Sat, 08 Dec 2012 16:20:39 GMT
Cleanup from 5025, allow recovering nodes to pull immediately


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5e462979
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5e462979
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5e462979

Branch: refs/heads/trunk
Commit: 5e4629793b41674bc4056e87e00eaa6bf30133fa
Parents: f618369
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Fri Dec 7 17:23:40 2012 -0600
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Fri Dec 7 17:29:02 2012 -0600

----------------------------------------------------------------------
 .../apache/cassandra/service/MigrationManager.java |   13 ++++++++++---
 .../apache/cassandra/service/StorageService.java   |    4 +---
 2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5e462979/src/java/org/apache/cassandra/service/MigrationManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/MigrationManager.java b/src/java/org/apache/cassandra/service/MigrationManager.java
index 72a9a84..9a82517 100644
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@ -33,6 +33,9 @@ import java.util.Collection;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,6 +68,10 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
     private static final int MIGRATION_REQUEST_RETRIES = 3;
     private static final ByteBuffer LAST_MIGRATION_KEY = ByteBufferUtil.bytes("Last Migration");
 
+    private static final RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
+
+    public static final int MIGRATION_DELAY_IN_MS = 60000;
+
     public void onJoin(InetAddress endpoint, EndpointState epState)
     {}
 
@@ -106,9 +113,9 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
         if (Schema.instance.getVersion().equals(theirVersion))
             return;
 
-        if (Schema.emptyVersion.equals(Schema.instance.getVersion()))
+        if (Schema.emptyVersion.equals(Schema.instance.getVersion()) || runtimeMXBean.getUptime()
< MIGRATION_DELAY_IN_MS)
         {
-            // If we think we may be bootstrapping, submit MigrationTask immediately
+            // If we think we may be bootstrapping or have recently started, submit MigrationTask
immediately
             submitMigrationTask(endpoint);
         }
         else
@@ -128,7 +135,7 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
                     submitMigrationTask(endpoint);
                 }
             };
-            StorageService.optionalTasks.schedule(runnable, 1, TimeUnit.MINUTES);
+            StorageService.optionalTasks.schedule(runnable, MIGRATION_DELAY_IN_MS, TimeUnit.MILLISECONDS);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5e462979/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index d041279..a948786 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -546,8 +546,7 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
         Gossiper.instance.start(SystemTable.incrementAndGetGeneration()); // needed for node-ring
gathering.
 
         // gossip Schema.emptyVersion forcing immediate check for schema updates (see MigrationManager#maybeScheduleSchemaPull)
-        Schema.instance.updateVersion(); // Ensure we know our own actual Schema UUID in
preparation for updates
-        MigrationManager.passiveAnnounce(Schema.emptyVersion);
+        Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual Schema
UUID in preparation for updates
 
         // add rpc listening info
         Gossiper.instance.addLocalApplicationState(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getRpcAddress()));
@@ -556,7 +555,6 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
 
         MessagingService.instance().listen(FBUtilities.getLocalAddress());
         LoadBroadcaster.instance.startBroadcasting();
-        MigrationManager.passiveAnnounce(Schema.instance.getVersion());
         Gossiper.instance.addLocalApplicationState(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
 
         HintedHandOffManager.instance.start();


Mime
View raw message