Author: jbellis
Date: Mon Sep 19 17:23:28 2011
New Revision: 1172720

URL: http://svn.apache.org/viewvc?rev=1172720&view=rev
Log:
merge from 1.0

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/contrib/   (props changed)
    
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
   (props changed)
    
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
   (props changed)
    
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
   (props changed)
    
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
   (props changed)
    
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
   (props changed)
    cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:23:28 2011
@@ -4,8 +4,8 @@
 
/cassandra/branches/cassandra-0.8:1090934-1125013,1125019-1171737,1172026,1172591
 /cassandra/branches/cassandra-0.8.0:1125021-1130369
 /cassandra/branches/cassandra-0.8.1:1101014-1125018
-/cassandra/branches/cassandra-1.0:1167085-1172704
-/cassandra/branches/cassandra-1.0.0:1167104-1167229,1167232-1172702
+/cassandra/branches/cassandra-1.0:1167085-1172719
+/cassandra/branches/cassandra-1.0.0:1167104-1167229,1167232-1172718
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1:1102511-1125020
 /incubator/cassandra/branches/cassandra-0.3:774578-796573

Propchange: cassandra/trunk/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:23:28 2011
@@ -4,8 +4,8 @@
 
/cassandra/branches/cassandra-0.8/contrib:1090934-1125013,1125019-1171737,1172026,1172591
 /cassandra/branches/cassandra-0.8.0/contrib:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/contrib:1101014-1125018
-/cassandra/branches/cassandra-1.0/contrib:1167085-1172704
-/cassandra/branches/cassandra-1.0.0/contrib:1167104-1167229,1167232-1172702
+/cassandra/branches/cassandra-1.0/contrib:1167085-1172719
+/cassandra/branches/cassandra-1.0.0/contrib:1167104-1167229,1167232-1172718
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/contrib:1102511-1125020
 /incubator/cassandra/branches/cassandra-0.3/contrib:774578-796573

Propchange: 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:23:28 2011
@@ -4,8 +4,8 @@
 
/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090934-1125013,1125019-1171737,1172026,1172591
 
/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1125021-1130369
 
/cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1167085-1172704
-/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1167104-1167229,1167232-1172702
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1167085-1172719
+/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1167104-1167229,1167232-1172718
 
/cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689
 
/cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1102511-1125020
 
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573

Propchange: 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:23:28 2011
@@ -4,8 +4,8 @@
 
/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090934-1125013,1125019-1171737,1172026,1172591
 
/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1125021-1130369
 
/cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1167085-1172704
-/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1167104-1167229,1167232-1172702
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1167085-1172719
+/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1167104-1167229,1167232-1172718
 
/cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689
 
/cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1102511-1125020
 
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198

Propchange: 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:23:28 2011
@@ -4,8 +4,8 @@
 
/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090934-1125013,1125019-1171737,1172026,1172591
 
/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1125021-1130369
 
/cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1167085-1172704
-/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1167104-1167229,1167232-1172702
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1167085-1172719
+/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1167104-1167229,1167232-1172718
 
/cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689
 
/cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1102511-1125020
 
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573

Propchange: 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:23:28 2011
@@ -4,8 +4,8 @@
 
/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090934-1125013,1125019-1171737,1172026,1172591
 
/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1125021-1130369
 
/cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1167085-1172704
-/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1167104-1167229,1167232-1172702
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1167085-1172719
+/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1167104-1167229,1167232-1172718
 
/cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689
 
/cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1102511-1125020
 
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573

Propchange: 
cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:23:28 2011
@@ -4,8 +4,8 @@
 
/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090934-1125013,1125019-1171737,1172026,1172591
 
/cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1125021-1130369
 
/cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1167085-1172704
-/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1167104-1167229,1167232-1172702
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1167085-1172719
+/cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1167104-1167229,1167232-1172718
 
/cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689
 
/cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1102511-1125020
 
/incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198

Modified: cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java?rev=1172720&r1=1172719&r2=1172720&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java 
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java Mon Sep 
19 17:23:28 2011
@@ -127,6 +127,24 @@ public class BootStrapper
         }
     }
 
+    /**
+     * if initialtoken was specified, use that.
+     * otherwise, pick a token to assume half the load of the most-loaded node.
+     */
+    public static Token getBootstrapToken(final TokenMetadata metadata, final 
Map<InetAddress, Double> load) throws IOException, ConfigurationException
+    {
+        if (DatabaseDescriptor.getInitialToken() != null)
+        {
+            logger.debug("token manually specified as " + 
DatabaseDescriptor.getInitialToken());
+            Token token = 
StorageService.getPartitioner().getTokenFactory().fromString(DatabaseDescriptor.getInitialToken());
+            if (metadata.getEndpoint(token) != null)
+                throw new ConfigurationException("Bootstraping to existing 
token " + token + " is not allowed (decommission/removetoken the old node 
first).");
+            return token;
+        }
+
+        return getBalancedToken(metadata, load);
+    }
+
     public static Token getBalancedToken(TokenMetadata metadata, 
Map<InetAddress, Double> load)
     {
         InetAddress maxEndpoint = getBootstrapSource(metadata, load);

Modified: 
cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: 
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=1172720&r1=1172719&r2=1172720&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java 
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java 
Mon Sep 19 17:23:28 2011
@@ -495,7 +495,9 @@ public class StorageService implements I
         // first startup is only chance to bootstrap
         Token<?> token;
         if (DatabaseDescriptor.isAutoBootstrap()
-            && 
!(DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress()) || 
SystemTable.isBootstrapped()))
+            && !(SystemTable.isBootstrapped()
+                 || 
DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress())
+                 || Schema.instance.getNonSystemTables().isEmpty()))
         {
             setMode("Joining: waiting for ring and schema information", true);
             try
@@ -517,7 +519,7 @@ public class StorageService implements I
                     throw new UnsupportedOperationException(s);
                 }
                 setMode("Joining: getting bootstrap token", true);
-                token = getNewToken();
+                token = BootStrapper.getBootstrapToken(tokenMetadata_, 
LoadBroadcaster.instance.getLoadInfo());
             }
             else
             {
@@ -539,55 +541,37 @@ public class StorageService implements I
                 setMode("Joining: Replacing a node with token: " + token, 
true);
             }
 
-            // don't bootstrap if there are no tables defined.
-            if (Schema.instance.getNonSystemTables().size() > 0)
-            {
-                bootstrap(token);
-                assert !isBootstrapMode; // bootstrap will block until finished
-            }
-            // Else: nothing to bootstrap, go directly to participating in ring
+            bootstrap(token);
+            assert !isBootstrapMode; // bootstrap will block until finished
         }
         else
         {
             token = SystemTable.getSavedToken();
             if (token == null)
-                token = getNewToken();
+            {
+                String initialToken = DatabaseDescriptor.getInitialToken();
+                if (initialToken == null)
+                {
+                    token = partitioner.getRandomToken();
+                    logger_.warn("Generated random token " + token + ". Random 
tokens will result in an unbalanced ring; see 
http://wiki.apache.org/cassandra/Operations";);
+                }
+                else
+                {
+                    token = 
partitioner.getTokenFactory().fromString(initialToken);
+                    logger_.info("Saved token not found. Using " + token + " 
from configuration");
+                }
+            }
             else
+            {
                 logger_.info("Using saved token " + token);
-        }
-
-        // start participating in the ring.
-        SystemTable.setBootstrapped(true);
-        setToken(token);
-        logger_.info("Bootstrap/Replace/Move completed! Now serving reads.");
-        assert tokenMetadata_.sortedTokens().size() > 0;
-    }
+            }
 
-    /**
-     * Return a new token for this node.
-     */
-    private Token getNewToken() throws ConfigurationException
-    {
-        Token token;
-        if (DatabaseDescriptor.getInitialToken() != null)
-        {
-            logger_.debug("token manually specified as {}", 
DatabaseDescriptor.getInitialToken());
-            token = 
StorageService.getPartitioner().getTokenFactory().fromString(DatabaseDescriptor.getInitialToken());
+            // start participating in the ring.
+            SystemTable.setBootstrapped(true);
+            setToken(token);
+            logger_.info("Bootstrap/Replace/Move completed! Now serving 
reads.");
+            assert tokenMetadata_.sortedTokens().size() > 0;
         }
-        else if (Schema.instance.getNonSystemTables().size() > 0)
-        {
-            // We are not bootstrapping, we are an initial node, 
getBalancedToken is not safe.
-            token = partitioner.getRandomToken();
-            logger_.warn("Generated random token " + token + ". Random tokens 
will result in an unbalanced ring; see 
http://wiki.apache.org/cassandra/Operation";);
-        }
-        else
-        {
-            token = BootStrapper.getBalancedToken(tokenMetadata_, 
LoadBroadcaster.instance.getLoadInfo());
-        }
-
-        if (tokenMetadata_.getEndpoint(token) != null)
-            throw new ConfigurationException("Bootstraping to existing token " 
+ token + " is not allowed (decommission/removetoken the old node first)");
-        return token;
     }
 
     public synchronized void joinRing() throws IOException, 
org.apache.cassandra.config.ConfigurationException


Reply via email to