Author: brandonwilliams Date: Thu Feb 10 22:35:13 2011 New Revision: 1069594
URL: http://svn.apache.org/viewvc?rev=1069594&view=rev Log: Keep endpoint state until aVeryLongTime when not a fat client Patch by brandonwilliams, reviewed by gdusbabek for CASSANDRA-2115 Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java?rev=1069594&r1=1069593&r2=1069594&view=diff ============================================================================== --- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java (original) +++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/gms/Gossiper.java Thu Feb 10 22:35:13 2011 @@ -235,17 +235,18 @@ public class Gossiper implements IFailur } /** - * Removes the endpoint from unreachable endpoint set + * Removes the endpoint from gossip completely * * @param endpoint endpoint to be removed from the current membership. */ void evictFromMembership(InetAddress endpoint) { unreachableEndpoints_.remove(endpoint); + endpointStateMap_.remove(endpoint); } /** - * Removes the endpoint completely from Gossip + * Removes the endpoint from Gossip but retains endpoint state */ public void removeEndpoint(InetAddress endpoint) { @@ -255,7 +256,7 @@ public class Gossiper implements IFailur liveEndpoints_.remove(endpoint); unreachableEndpoints_.remove(endpoint); - // do not remove endpointState until the quarantine expires + // do not remove endpointState until aVeryLongTime FailureDetector.instance.remove(endpoint); justRemovedEndpoints_.put(endpoint, System.currentTimeMillis()); } @@ -425,20 +426,15 @@ 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.getHasToken() && !epState.isAlive() && (duration > FatClientTimeout_)) + if (!epState.getHasToken() && !epState.isAlive() && !justRemovedEndpoints_.containsKey(endpoint) && (duration > FatClientTimeout_)) { - if (StorageService.instance.getTokenMetadata().isMember(endpoint)) - epState.setHasToken(true); - else - { - if (!justRemovedEndpoints_.containsKey(endpoint)) // if the node was decommissioned, it will have been removed but still appear as a fat client - { - logger_.info("FatClient " + endpoint + " has been silent for " + FatClientTimeout_ + "ms, removing from gossip"); - removeEndpoint(endpoint); // after quarantine justRemoveEndpoints will remove the state - } - } + 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 ( !epState.isAlive() && (duration > aVeryLongTime_) ) @@ -458,7 +454,6 @@ public class Gossiper implements IFailur if (logger_.isDebugEnabled()) logger_.debug(QUARANTINE_DELAY + " elapsed, " + entry.getKey() + " gossip quarantine over"); justRemovedEndpoints_.remove(entry.getKey()); - endpointStateMap_.remove(entry.getKey()); } } }
