You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2013/01/15 16:25:57 UTC

git commit: Don't remove tokens for node we know in System.peers

Updated Branches:
  refs/heads/cassandra-1.2 79764f743 -> ec35427fd


Don't remove tokens for node we know in System.peers

patch by slebresne; reviewed by driftx for CASSANDRA-5121


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ec35427f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ec35427f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ec35427f

Branch: refs/heads/cassandra-1.2
Commit: ec35427fdfbc46a8adeafc042651f552b9bcc1a0
Parents: 79764f7
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Jan 15 16:24:54 2013 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Jan 15 16:24:54 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 src/java/org/apache/cassandra/db/SystemTable.java  |    1 +
 .../apache/cassandra/service/StorageService.java   |    3 ++-
 3 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ec35427f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2e8d2c9..32ed9fa 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -34,6 +34,7 @@
  * Validate login for describe_keyspace, describe_keyspaces and set_keyspace
    (CASSANDRA-5144)
  * Fix inserting empty maps (CASSANDRA-5141)
+ * Don't remove tokens from System table for node we know (CASSANDRA-5121)
 Merged from 1.1:
  * Simplify CompressedRandomAccessReader to work around JDK FD bug (CASSANDRA-5088)
  * Improve handling a changing target throttle rate mid-compaction (CASSANDRA-5087)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ec35427f/src/java/org/apache/cassandra/db/SystemTable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemTable.java b/src/java/org/apache/cassandra/db/SystemTable.java
index 8f60904..18a2666 100644
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@ -321,6 +321,7 @@ public class SystemTable
     */
     public static synchronized void updateTokens(Collection<Token> tokens)
     {
+        assert !tokens.isEmpty() : "removeTokens should be used instead";
         String req = "INSERT INTO system.%s (key, tokens) VALUES ('%s', %s)";
         processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, tokensAsSet(tokens)));
         forceBlockingFlush(LOCAL_CF);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ec35427f/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 efa7487..fe3ee93 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1388,7 +1388,8 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
         tokenMetadata.updateNormalTokens(tokensToUpdateInMetadata, endpoint);
         for (InetAddress ep : endpointsToRemove)
             Gossiper.instance.removeEndpoint(ep);
-        SystemTable.updateTokens(endpoint, tokensToUpdateInSystemTable);
+        if (!tokensToUpdateInSystemTable.isEmpty())
+            SystemTable.updateTokens(endpoint, tokensToUpdateInSystemTable);
         SystemTable.updateLocalTokens(Collections.<Token>emptyList(), localTokensToRemove);
 
         if (tokenMetadata.isMoving(endpoint)) // if endpoint was moving to a new token