Increase quarantine on replacement Patch by brandonwilliams, reviewed by jasobrown for CASSANDRA-8260
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d8642ae3 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d8642ae3 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d8642ae3 Branch: refs/heads/cassandra-2.1 Commit: d8642ae396033c059cb75b3c35a2ece067c17035 Parents: 7a14a77 Author: Brandon Williams <brandonwilli...@apache.org> Authored: Mon Dec 1 10:34:26 2014 -0600 Committer: Brandon Williams <brandonwilli...@apache.org> Committed: Mon Dec 1 10:34:26 2014 -0600 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/gms/Gossiper.java | 25 +++++++++++++++++++- .../cassandra/service/StorageService.java | 4 ++++ 3 files changed, 29 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d8642ae3/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 8f4add9..57c0a26 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.0.12: + * Increase quarantine delay on replacement (CASSANDRA-8260) * Expose off-heap memory usage stats (CASSANDRA-7897) * Ignore Paxos commits for truncated tables (CASSANDRA-7538) * Validate size of indexed column values (CASSANDRA-8280) http://git-wip-us.apache.org/repos/asf/cassandra/blob/d8642ae3/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 eb0cf39..a478405 100644 --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@ -380,7 +380,29 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean */ private void quarantineEndpoint(InetAddress endpoint) { - justRemovedEndpoints.put(endpoint, System.currentTimeMillis()); + quarantineEndpoint(endpoint, System.currentTimeMillis()); + } + + /** + * Quarantines the endpoint until quarantineExpiration + QUARANTINE_DELAY + * + * @param endpoint + * @param quarantineExpiration + */ + private void quarantineEndpoint(InetAddress endpoint, long quarantineExpiration) + { + justRemovedEndpoints.put(endpoint, quarantineExpiration); + } + + /** + * Quarantine endpoint specifically for replacement purposes. + * @param endpoint + */ + public void replacementQuarantine(InetAddress endpoint) + { + // remember, quarantineEndpoint will effectively already add QUARANTINE_DELAY, so this is 2x + logger.debug(""); + quarantineEndpoint(endpoint, System.currentTimeMillis() + QUARANTINE_DELAY); } /** @@ -393,6 +415,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean { removeEndpoint(endpoint); evictFromMembership(endpoint); + replacementQuarantine(endpoint); } /** http://git-wip-us.apache.org/repos/asf/cassandra/blob/d8642ae3/src/java/org/apache/cassandra/service/StorageService.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 14b397a..601e036 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -1607,7 +1607,11 @@ public class StorageService extends NotificationBroadcasterSupport implements IE tokenMetadata.updateNormalTokens(tokensToUpdateInMetadata, endpoint); for (InetAddress ep : endpointsToRemove) + { removeEndpoint(ep); + if (DatabaseDescriptor.isReplacing() && DatabaseDescriptor.getReplaceAddress().equals(ep)) + Gossiper.instance.replacementQuarantine(ep); // quarantine locally longer than normally; see CASSANDRA-8260 + } if (!tokensToUpdateInSystemKeyspace.isEmpty()) SystemKeyspace.updateTokens(endpoint, tokensToUpdateInSystemKeyspace); if (!localTokensToRemove.isEmpty())