Revert "Keep endpoint state until aVeryLongTime when not a fat client"

This reverts commit db9164ffd96ebc7752fc5789c90c7211ba323ad2.

For CASSANDRA-2371.

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.7@1094694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Williams 2011-04-18 18:57:23 +00:00
parent 86f6184d0d
commit ca1c8bf247
1 changed files with 15 additions and 10 deletions

View File

@ -237,18 +237,17 @@ public class Gossiper implements IFailureDetectionEventListener
}
/**
* Removes the endpoint from gossip completely
* Removes the endpoint from unreachable endpoint set
*
* @param endpoint endpoint to be removed from the current membership.
*/
void evictFromMembership(InetAddress endpoint)
{
unreachableEndpoints_.remove(endpoint);
endpointStateMap_.remove(endpoint);
}
/**
* Removes the endpoint from Gossip but retains endpoint state
* Removes the endpoint completely from Gossip
*/
public void removeEndpoint(InetAddress endpoint)
{
@ -258,7 +257,7 @@ public class Gossiper implements IFailureDetectionEventListener
liveEndpoints_.remove(endpoint);
unreachableEndpoints_.remove(endpoint);
// do not remove endpointState until aVeryLongTime
// do not remove endpointState until the quarantine expires
FailureDetector.instance.remove(endpoint);
justRemovedEndpoints_.put(endpoint, System.currentTimeMillis());
}
@ -428,15 +427,20 @@ public class Gossiper implements IFailureDetectionEventListener
{
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() && !justRemovedEndpoints_.containsKey(endpoint) && (duration > FatClientTimeout_))
if (!epState.getHasToken() && !epState.isAlive() && (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
{
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
}
}
}
if ( !epState.isAlive() && (duration > aVeryLongTime_) )
@ -456,6 +460,7 @@ public class Gossiper implements IFailureDetectionEventListener
if (logger_.isDebugEnabled())
logger_.debug(QUARANTINE_DELAY + " elapsed, " + entry.getKey() + " gossip quarantine over");
justRemovedEndpoints_.remove(entry.getKey());
endpointStateMap_.remove(entry.getKey());
}
}
}