cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasobr...@apache.org
Subject [1/2] git commit: CASSANDRA-5459: remove node from seeds when it completely leaves the cluster. This version slightly refactors Gossiper by pulling th seeds list building code out of start() and into a shared method that removeEndpoint() will call. Also,
Date Fri, 12 Apr 2013 20:15:46 GMT
Updated Branches:
  refs/heads/cassandra-1.2 ef5390b6d -> d7066f460


CASSANDRA-5459: remove node from seeds when it completely leaves the cluster.
This version slightly refactors Gossiper by pulling th seeds list building code
out of start() and into a shared method that removeEndpoint() will call.
Also, reload the seeds list, then remove the dead node.


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

Branch: refs/heads/cassandra-1.2
Commit: 8d6ed07b5bb97c6b82fd8962061f7c38439fb3aa
Parents: d2eadba
Author: Jason Brown <jasedbrown@gmail.com>
Authored: Fri Apr 12 09:36:19 2013 -0700
Committer: Jason Brown <jasedbrown@gmail.com>
Committed: Fri Apr 12 13:05:51 2013 -0700

----------------------------------------------------------------------
 src/java/org/apache/cassandra/gms/Gossiper.java |   27 ++++++++++++------
 1 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8d6ed07b/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 997ff71..6302cc6 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -310,6 +310,13 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         for (IEndpointStateChangeSubscriber subscriber : subscribers)
             subscriber.onRemove(endpoint);
 
+        if(seeds.contains(endpoint))
+        {
+            buildSeedsList();
+            seeds.remove(endpoint);
+            logger.info("removed {} from seeds, updated seeds list = {}", endpoint, seeds);
+        }
+
         liveEndpoints.remove(endpoint);
         unreachableEndpoints.remove(endpoint);
         // do not remove endpointState until the quarantine expires
@@ -1064,15 +1071,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
      */
     public void start(int generationNbr)
     {
-        /* Get the seeds from the config and initialize them. */
-        Set<InetAddress> seedHosts = DatabaseDescriptor.getSeeds();
-        for (InetAddress seed : seedHosts)
-        {
-            if (seed.equals(FBUtilities.getBroadcastAddress()))
-                continue;
-            seeds.add(seed);
-        }
-
+        buildSeedsList();
         /* initialize the heartbeat state for this localEndpoint */
         maybeInitializeLocalState(generationNbr);
         EndpointState localState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
@@ -1088,6 +1087,16 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
                                                               TimeUnit.MILLISECONDS);
     }
 
+    private void buildSeedsList()
+    {
+        for (InetAddress seed : DatabaseDescriptor.getSeeds())
+        {
+            if (seed.equals(FBUtilities.getBroadcastAddress()))
+                continue;
+            seeds.add(seed);
+        }
+    }
+
     // initialize local HB state if needed.
     public void maybeInitializeLocalState(int generationNbr)
     {


Mime
View raw message