Updated Branches:
  refs/heads/trunk a20edf961 -> f8e52ea98

rename serializeTokens -> tokensAsSet


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

Branch: refs/heads/trunk
Commit: f8e52ea98d10d643e8a8afb38affd9ac95dda6fe
Parents: a20edf9
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Sat Nov 3 13:50:10 2012 -0500
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Sat Nov 3 16:19:23 2012 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/SystemTable.java |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8e52ea9/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 eb6eecd..a14ba58 100644
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@ -162,7 +162,7 @@ public class SystemTable
             }
             // serialize the old token as a collection of (one )tokens.
             Token token = 
StorageService.getPartitioner().getTokenFactory().fromByteArray(oldColumns.next().value());
-            String tokenBytes = serializeTokens(Collections.singleton(token));
+            String tokenBytes = tokensAsSet(Collections.singleton(token));
             // (assume that any node getting upgraded was bootstrapped, since 
that was stored in a separate row for no particular reason)
             String req = "INSERT INTO system.%s (key, cluster_name, tokens, 
bootstrapped) VALUES ('%s', '%s', %s, '%s')";
             processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, 
clusterName, tokenBytes, BootstrapState.COMPLETED.name()));
@@ -190,10 +190,9 @@ public class SystemTable
         }
 
         String req = "INSERT INTO system.%s (peer, tokens) VALUES ('%s', %s)";
-        processInternal(String.format(req, PEERS_CF, ep.getHostAddress(), 
serializeTokens(tokens)));
+        processInternal(String.format(req, PEERS_CF, ep.getHostAddress(), 
tokensAsSet(tokens)));
         forceBlockingFlush(PEERS_CF);
     }
-
     public static synchronized void updatePeerInfo(InetAddress ep, String 
columnName, String value)
     {
         if (ep.equals(FBUtilities.getBroadcastAddress()))
@@ -203,7 +202,7 @@ public class SystemTable
         processInternal(String.format(req, PEERS_CF, columnName, 
ep.getHostAddress(), value));
     }
 
-    private static String serializeTokens(Collection<Token> tokens)
+    private static String tokensAsSet(Collection<Token> tokens)
     {
         Token.TokenFactory factory = 
StorageService.getPartitioner().getTokenFactory();
         StringBuilder sb = new StringBuilder();
@@ -241,7 +240,7 @@ public class SystemTable
                 continue;
 
             String req = "UPDATE system.%s SET tokens = tokens - %s WHERE peer 
= '%s'";
-            processInternal(String.format(req, PEERS_CF, 
serializeTokens(toRemove), entry.getKey().getHostAddress()));
+            processInternal(String.format(req, PEERS_CF, 
tokensAsSet(toRemove), entry.getKey().getHostAddress()));
         }
         forceBlockingFlush(PEERS_CF);
     }
@@ -252,7 +251,7 @@ public class SystemTable
     public static synchronized void updateTokens(Collection<Token> tokens)
     {
         String req = "INSERT INTO system.%s (key, tokens) VALUES ('%s', %s)";
-        processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, 
serializeTokens(tokens)));
+        processInternal(String.format(req, LOCAL_CF, LOCAL_KEY, 
tokensAsSet(tokens)));
         forceBlockingFlush(LOCAL_CF);
     }
 

Reply via email to