diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java index 997ff71ca0..6302cc685f 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 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) {