Repository: cassandra Updated Branches: refs/heads/trunk 746e9e419 -> 8f189d110
Do not run SizeEstimatesRecorder if a node is not a member of the ring patch by Paulo Motta; reviewed by Joel Knighton for CASSANDRA-9912 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2ca75990 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2ca75990 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2ca75990 Branch: refs/heads/trunk Commit: 2ca7599023a1e507f263b0c4854ab26b3ba283ac Parents: b6015fa Author: Paulo Motta <pauloricard...@gmail.com> Authored: Thu Oct 29 12:03:21 2015 -0700 Committer: Aleksey Yeschenko <alek...@apache.org> Committed: Fri Nov 6 00:00:38 2015 +0000 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/db/SizeEstimatesRecorder.java | 5 +++-- .../org/apache/cassandra/db/SystemKeyspace.java | 16 ---------------- .../apache/cassandra/service/StorageService.java | 5 +---- 4 files changed, 5 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/2ca75990/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 5ceabb4..a994ca1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 2.1.12 + * Do not run SizeEstimatesRecorder if a node is not a member of the ring (CASSANDRA-9912) * Improve handling of dead nodes in gossip (CASSANDRA-10298) * Fix logback-tools.xml incorrectly configured for outputing to System.err (CASSANDRA-9937) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2ca75990/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java b/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java index 13d9c60..fe4ebd3 100644 --- a/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java +++ b/src/java/org/apache/cassandra/db/SizeEstimatesRecorder.java @@ -29,6 +29,7 @@ import org.apache.cassandra.io.sstable.SSTableReader; import org.apache.cassandra.service.MigrationListener; import org.apache.cassandra.service.MigrationManager; import org.apache.cassandra.service.StorageService; +import org.apache.cassandra.utils.FBUtilities; import org.apache.cassandra.utils.Pair; import org.apache.cassandra.utils.concurrent.Refs; @@ -55,9 +56,9 @@ public class SizeEstimatesRecorder extends MigrationListener implements Runnable public void run() { - if (StorageService.instance.isStarting()) + if (!StorageService.instance.getTokenMetadata().isMember(FBUtilities.getBroadcastAddress())) { - logger.debug("Node has not yet joined; not recording size estimates"); + logger.debug("Node is not part of the ring; not recording size estimates"); return; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2ca75990/src/java/org/apache/cassandra/db/SystemKeyspace.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java index 54fdb47..c600652 100644 --- a/src/java/org/apache/cassandra/db/SystemKeyspace.java +++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java @@ -462,22 +462,6 @@ public class SystemKeyspace forceBlockingFlush(LOCAL_CF); } - /** - * Convenience method to update the list of tokens in the local system keyspace. - * - * @param addTokens tokens to add - * @param rmTokens tokens to remove - * @return the collection of persisted tokens - */ - public static synchronized Collection<Token> updateLocalTokens(Collection<Token> addTokens, Collection<Token> rmTokens) - { - Collection<Token> tokens = getSavedTokens(); - tokens.removeAll(rmTokens); - tokens.addAll(addTokens); - updateTokens(tokens); - return tokens; - } - public static void forceBlockingFlush(String cfname) { if (!Boolean.getBoolean("cassandra.unsafesystem")) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2ca75990/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 d02a572..af3a00c 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -1687,7 +1687,6 @@ public class StorageService extends NotificationBroadcasterSupport implements IE Set<Token> tokensToUpdateInMetadata = new HashSet<>(); Set<Token> tokensToUpdateInSystemKeyspace = new HashSet<>(); - Set<Token> localTokensToRemove = new HashSet<>(); Set<InetAddress> endpointsToRemove = new HashSet<>(); @@ -1790,9 +1789,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE Gossiper.instance.replacementQuarantine(ep); // quarantine locally longer than normally; see CASSANDRA-8260 } if (!tokensToUpdateInSystemKeyspace.isEmpty()) - SystemKeyspace.updateTokens(endpoint, tokensToUpdateInSystemKeyspace); - if (!localTokensToRemove.isEmpty()) - SystemKeyspace.updateLocalTokens(Collections.<Token>emptyList(), localTokensToRemove); + SystemKeyspace.updateTokens(endpoint, tokensToUpdateInSystemKeyspace);; if (isMoving || operationMode == Mode.MOVING) {