cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [1/8] git commit: Move handling of migration event source to solve bootstrap race. Patch by Sergio Bossa and brandonwilliams, reviewed by Tyler Hobbs for CASSANDRA-6648
Date Wed, 05 Feb 2014 00:36:32 GMT
Updated Branches:
  refs/heads/cassandra-1.2 814a91209 -> ed5cac1d2
  refs/heads/cassandra-2.0 723fcd193 -> 93bd89fbb
  refs/heads/trunk c947c126f -> 9d4f7c918


Move handling of migration event source to solve bootstrap race.
Patch by Sergio Bossa and brandonwilliams, reviewed by Tyler Hobbs for
CASSANDRA-6648


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

Branch: refs/heads/cassandra-1.2
Commit: ed5cac1d2ab18f03ec2fe211c46b5382729b4c4d
Parents: 814a912
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Tue Feb 4 18:23:30 2014 -0600
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Tue Feb 4 18:23:30 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                     |  3 ++
 .../cassandra/service/MigrationManager.java     | 30 ++++----------------
 .../cassandra/service/StorageService.java       |  7 ++---
 3 files changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ed5cac1d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 981f977..b2e892e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,6 @@
+1.2.15
+ * Move handling of migration event source to solve bootstrap race (CASSANDRA-6648)
+
 1.2.14
  * Reverted code to limit CQL prepared statement cache by size (CASSANDRA-6592)
  * add cassandra.default_messaging_version property to allow easier

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ed5cac1d/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 3ede35e..37d5f43 100644
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@ -50,7 +50,7 @@ import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.UUIDGen;
 import org.apache.cassandra.utils.WrappedRunnable;
 
-public class MigrationManager implements IEndpointStateChangeSubscriber
+public class MigrationManager
 {
     private static final Logger logger = LoggerFactory.getLogger(MigrationManager.class);
 
@@ -63,7 +63,7 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
     public static final int MIGRATION_DELAY_IN_MS = 60000;
 
     private final List<IMigrationListener> listeners = new CopyOnWriteArrayList<IMigrationListener>();
-
+    
     private MigrationManager() {}
 
     public void register(IMigrationListener listener)
@@ -76,34 +76,14 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
         listeners.remove(listener);
     }
 
-    public void onJoin(InetAddress endpoint, EndpointState epState)
-    {}
-
-    public void onChange(InetAddress endpoint, ApplicationState state, VersionedValue value)
-    {
-        if (state != ApplicationState.SCHEMA || endpoint.equals(FBUtilities.getBroadcastAddress()))
-            return;
-
-        maybeScheduleSchemaPull(UUID.fromString(value.value), endpoint);
-    }
-
-    public void onAlive(InetAddress endpoint, EndpointState state)
+    public void scheduleSchemaPull(InetAddress endpoint, EndpointState state)
     {
         VersionedValue value = state.getApplicationState(ApplicationState.SCHEMA);
 
-        if (value != null)
+        if (!endpoint.equals(FBUtilities.getBroadcastAddress()) && value != null)
             maybeScheduleSchemaPull(UUID.fromString(value.value), endpoint);
     }
 
-    public void onDead(InetAddress endpoint, EndpointState state)
-    {}
-
-    public void onRestart(InetAddress endpoint, EndpointState state)
-    {}
-
-    public void onRemove(InetAddress endpoint)
-    {}
-
     /**
      * If versions differ this node sends request with local migration list to the endpoint
      * and expecting to receive a list of migrations to apply locally.
@@ -165,7 +145,7 @@ public class MigrationManager implements IEndpointStateChangeSubscriber
 
     public static boolean isReadyForBootstrap()
     {
-        return ((ThreadPoolExecutor) StageManager.getStage(Stage.MIGRATION)).getActiveCount()
== 0;
+        return Schema.instance.getVersion() != null && !Schema.emptyVersion.equals(Schema.instance.getVersion());
     }
 
     public void notifyCreateKeyspace(KSMetaData ksm)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ed5cac1d/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 c4b1b2e..fa43154 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -185,8 +185,6 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
     private static enum Mode { NORMAL, CLIENT, JOINING, LEAVING, DECOMMISSIONED, MOVING,
DRAINING, DRAINED, RELOCATING }
     private Mode operationMode;
 
-    private final MigrationManager migrationManager = MigrationManager.instance;
-
     /* Used for tracking drain progress */
     private volatile int totalCFs, remainingCFs;
 
@@ -376,7 +374,6 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
 
     public void stopClient()
     {
-        Gossiper.instance.unregister(migrationManager);
         Gossiper.instance.unregister(this);
         Gossiper.instance.stop();
         MessagingService.instance().shutdown();
@@ -464,7 +461,6 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
         logger.info("Starting up client gossip");
         setMode(Mode.CLIENT, false);
         Gossiper.instance.register(this);
-        Gossiper.instance.register(migrationManager);
         Gossiper.instance.start((int) (System.currentTimeMillis() / 1000)); // needed for
node-ring gathering.
         Gossiper.instance.addLocalApplicationState(ApplicationState.NET_VERSION, valueFactory.networkVersion());
 
@@ -620,7 +616,6 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
         appStates.put(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
         logger.info("Starting up server gossip");
         Gossiper.instance.register(this);
-        Gossiper.instance.register(migrationManager);
         Gossiper.instance.start(SystemTable.incrementAndGetGeneration(), appStates); // needed
for node-ring gathering.
         // gossip snitch infos (local DC and rack)
         gossipSnitchInfo();
@@ -1981,6 +1976,7 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
         {
             onChange(endpoint, entry.getKey(), entry.getValue());
         }
+        MigrationManager.instance.scheduleSchemaPull(endpoint, epState);
     }
 
     public void onAlive(InetAddress endpoint, EndpointState state)
@@ -1999,6 +1995,7 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
             for (IEndpointLifecycleSubscriber subscriber : lifecycleSubscribers)
                 subscriber.onJoinCluster(endpoint);
         }
+        MigrationManager.instance.scheduleSchemaPull(endpoint, state);
     }
 
     public void onRemove(InetAddress endpoint)


Mime
View raw message