cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r769019 - in /incubator/cassandra/trunk: src/org/apache/cassandra/db/ src/org/apache/cassandra/dht/ src/org/apache/cassandra/locator/ src/org/apache/cassandra/service/ test/org/apache/cassandra/locator/ test/unit/org/apache/cassandra/db/
Date Mon, 27 Apr 2009 15:01:51 GMT
Author: jbellis
Date: Mon Apr 27 15:01:51 2009
New Revision: 769019

URL: http://svn.apache.org/viewvc?rev=769019&view=rev
Log:
rename getDefaultToken -> getInitialToken
patch by jbellis; reviewed by Jun Rao for CASSANDRA-65

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/org/apache/cassandra/dht/IPartitioner.java
    incubator/cassandra/trunk/src/org/apache/cassandra/dht/OrderPreservingPartitioner.java
    incubator/cassandra/trunk/src/org/apache/cassandra/dht/RandomPartitioner.java
    incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackAwareStrategy.java
    incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackUnawareStrategy.java
    incubator/cassandra/trunk/src/org/apache/cassandra/service/StorageService.java
    incubator/cassandra/trunk/test/org/apache/cassandra/locator/RackUnawareStrategyTest.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java Mon Apr 27
15:01:51 2009
@@ -1113,7 +1113,7 @@
 	                            continue;
 	                    	}
 	                    }
-                        if (Range.isTokenInRanges(StorageService.getPartitioner().getTokenForKey(lastkey),
ranges))
+                        if (Range.isTokenInRanges(StorageService.getPartitioner().getInitialToken(lastkey),
ranges))
 	                    {
 	                        if(ssTableRange == null )
 	                        {
@@ -1143,7 +1143,7 @@
 	                    			continue;
 	                    		}
 	                    		/* keep on looping until we find a key in the range */
-                                while (!Range.isTokenInRanges(StorageService.getPartitioner().getTokenForKey(filestruct.getKey()),
ranges))
+                                while (!Range.isTokenInRanges(StorageService.getPartitioner().getInitialToken(filestruct.getKey()),
ranges))
 	                            {
                                     filestruct.advance();
                                     if (filestruct.isExhausted())

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/dht/IPartitioner.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/dht/IPartitioner.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/dht/IPartitioner.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/dht/IPartitioner.java Mon Apr 27 15:01:51
2009
@@ -37,7 +37,10 @@
 
     public Comparator<String> getReverseDecoratedKeyComparator();
 
-    public Token getTokenForKey(String key);
+    /**
+     * @return the token to use for this node if none was saved
+     */
+    public Token getInitialToken(String key);
 
     public Token getDefaultToken();
 

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/dht/OrderPreservingPartitioner.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/dht/OrderPreservingPartitioner.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/dht/OrderPreservingPartitioner.java
(original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/dht/OrderPreservingPartitioner.java
Mon Apr 27 15:01:51 2009
@@ -110,7 +110,7 @@
         return tokenFactory;
     }
 
-    public Token getTokenForKey(String key)
+    public Token getInitialToken(String key)
     {
         return new StringToken(key);
     }

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/dht/RandomPartitioner.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/dht/RandomPartitioner.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/dht/RandomPartitioner.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/dht/RandomPartitioner.java Mon Apr
27 15:01:51 2009
@@ -103,7 +103,7 @@
         return tokenFactory;
     }
 
-    public Token getTokenForKey(String key)
+    public Token getInitialToken(String key)
     {
         return new BigIntegerToken(FBUtilities.hash(key));
     }

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackAwareStrategy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackAwareStrategy.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackAwareStrategy.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackAwareStrategy.java Mon
Apr 27 15:01:51 2009
@@ -110,7 +110,7 @@
 
         for ( String key : keys )
         {
-            results.put(key, getStorageEndPoints(partitioner_.getTokenForKey(key)));
+            results.put(key, getStorageEndPoints(partitioner_.getInitialToken(key)));
         }
 
         return results;

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackUnawareStrategy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackUnawareStrategy.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackUnawareStrategy.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/locator/RackUnawareStrategy.java Mon
Apr 27 15:01:51 2009
@@ -67,7 +67,7 @@
 
         for ( String key : keys )
         {
-            results.put(key, getStorageEndPoints(partitioner_.getTokenForKey(key)));
+            results.put(key, getStorageEndPoints(partitioner_.getInitialToken(key)));
         }
 
         return results;

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/service/StorageService.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/service/StorageService.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/service/StorageService.java Mon Apr
27 15:01:51 2009
@@ -774,7 +774,7 @@
 	        Token[] tokens = tokenToEndPointMap.keySet().toArray(new Token[tokenToEndPointMap.keySet().size()]);
 	        Arrays.sort(tokens);
 	        int index = Arrays.binarySearch(tokens, token) * (keys.length/tokens.length);
-            Token newToken = partitioner_.getTokenForKey(keys[index]);
+            Token newToken = partitioner_.getInitialToken(keys[index]);
 	        /* update the token */
 	        updateToken(newToken);
     	}
@@ -1064,7 +1064,7 @@
     public EndPoint getPrimary(String key)
     {
         EndPoint endpoint = StorageService.tcpAddr_;
-        Token token = partitioner_.getTokenForKey(key);
+        Token token = partitioner_.getInitialToken(key);
         Map<Token, EndPoint> tokenToEndPointMap = tokenMetadata_.cloneTokenEndPointMap();
         List tokens = new ArrayList<Token>(tokenToEndPointMap.keySet());
         if (tokens.size() > 0)
@@ -1112,7 +1112,7 @@
      */
     public EndPoint[] getNStorageEndPoint(String key)
     {
-        return nodePicker_.getStorageEndPoints(partitioner_.getTokenForKey(key));
+        return nodePicker_.getStorageEndPoints(partitioner_.getInitialToken(key));
     }
     
     private Map<String, EndPoint[]> getNStorageEndPoints(String[] keys)
@@ -1151,7 +1151,7 @@
      */
     public Map<EndPoint, EndPoint> getNStorageEndPointMap(String key)
     {
-        return nodePicker_.getHintedStorageEndPoints(partitioner_.getTokenForKey(key));
+        return nodePicker_.getHintedStorageEndPoints(partitioner_.getInitialToken(key));
     }
 
     /**

Modified: incubator/cassandra/trunk/test/org/apache/cassandra/locator/RackUnawareStrategyTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/org/apache/cassandra/locator/RackUnawareStrategyTest.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/org/apache/cassandra/locator/RackUnawareStrategyTest.java
(original)
+++ incubator/cassandra/trunk/test/org/apache/cassandra/locator/RackUnawareStrategyTest.java
Mon Apr 27 15:01:51 2009
@@ -2,7 +2,6 @@
 
 import java.util.List;
 import java.util.ArrayList;
-import java.math.BigInteger;
 
 import org.testng.annotations.Test;
 import org.apache.cassandra.dht.IPartitioner;
@@ -42,7 +41,7 @@
         List<Token> keyTokens = new ArrayList<Token>();
         for (int i = 0; i < 5; i++) {
             endPointTokens.add(new StringToken(String.valueOf((char)('a' + i * 2))));
-            keyTokens.add(partitioner.getTokenForKey(String.valueOf((char)('a' + i * 2 +
1))));
+            keyTokens.add(partitioner.getInitialToken(String.valueOf((char)('a' + i * 2 +
1))));
         }
         testGetStorageEndPoints(tmd, strategy, endPointTokens.toArray(new Token[0]), keyTokens.toArray(new
Token[0]));
     }

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java?rev=769019&r1=769018&r2=769019&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java Mon Apr
27 15:01:51 2009
@@ -9,6 +9,6 @@
 public class SystemTableTest extends ServerTest {
     @Test
     public void testMain() throws IOException {
-        SystemTable.openSystemTable(SystemTable.cfName_).updateToken(StorageService.getPartitioner().getTokenForKey("503545744:0"));
+        SystemTable.openSystemTable(SystemTable.cfName_).updateToken(StorageService.getPartitioner().getInitialToken("503545744:0"));
     }
 }



Mime
View raw message