Author: brandonwilliams Date: Fri Oct 21 22:28:16 2011 New Revision: 1187579
URL: http://svn.apache.org/viewvc?rev=1187579&view=rev Log: Merge 3351 Modified: cassandra/branches/cassandra-1.0/CHANGES.txt cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java Modified: cassandra/branches/cassandra-1.0/CHANGES.txt URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/CHANGES.txt?rev=1187579&r1=1187578&r2=1187579&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0/CHANGES.txt (original) +++ cassandra/branches/cassandra-1.0/CHANGES.txt Fri Oct 21 22:28:16 2011 @@ -50,6 +50,7 @@ Merged from 0.8: * fix assertionError during repair with ordered partitioners (CASSANDRA-3369) * correctly serialize key_validation_class for avro (CASSANDRA-3391) * don't expire counter tombstone after streaming (CASSANDRA-3394) + * prevent nodes that failed to join from hanging around forever (CASSANDRA-3351) 1.0.0-final Modified: cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java?rev=1187579&r1=1187578&r2=1187579&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java (original) +++ cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java Fri Oct 21 22:28:16 2011 @@ -562,15 +562,18 @@ public class Gossiper implements IFailur { long duration = now - epState.getUpdateTimestamp(); - if (StorageService.instance.getTokenMetadata().isMember(endpoint)) - epState.setHasToken(true); // check if this is a fat client. fat clients are removed automatically from // gosip after FatClientTimeout if (!epState.hasToken() && !epState.isAlive() && !justRemovedEndpoints.containsKey(endpoint) && (duration > FatClientTimeout)) { - logger.info("FatClient " + endpoint + " has been silent for " + FatClientTimeout + "ms, removing from gossip"); - removeEndpoint(endpoint); // will put it in justRemovedEndpoints to respect quarantine delay - evictFromMembership(endpoint); // can get rid of the state immediately + if (StorageService.instance.getTokenMetadata().isMember(endpoint)) + epState.setHasToken(true); + else + { + logger.info("FatClient " + endpoint + " has been silent for " + FatClientTimeout + "ms, removing from gossip"); + removeEndpoint(endpoint); // will put it in justRemovedEndpoints to respect quarantine delay + evictFromMembership(endpoint); // can get rid of the state immediately + } } long expireTime = getExpireTimeForEndpoint(endpoint); @@ -768,7 +771,7 @@ public class Gossiper implements IFailur */ private void handleMajorStateChange(InetAddress ep, EndpointState epState) { - if (epState.getApplicationState(ApplicationState.STATUS) != null && !isDeadState(epState)) + if (!isDeadState(epState)) { if (endpointStateMap.get(ep) != null) logger.info("Node {} has restarted, now UP", ep); @@ -783,7 +786,7 @@ public class Gossiper implements IFailur for (IEndpointStateChangeSubscriber subscriber : subscribers) subscriber.onRestart(ep, epState); - if (epState.getApplicationState(ApplicationState.STATUS) != null && !isDeadState(epState)) + if (!isDeadState(epState)) markAlive(ep, epState); else { @@ -797,6 +800,8 @@ public class Gossiper implements IFailur public Boolean isDeadState(EndpointState epState) { + if (epState.getApplicationState(ApplicationState.STATUS) == null) + return false; String value = epState.getApplicationState(ApplicationState.STATUS).value; String[] pieces = value.split(VersionedValue.DELIMITER_STR, -1); assert (pieces.length > 0);
