cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [03/11] git commit: fix assertionerror from #6132
Date Thu, 03 Oct 2013 17:12:53 GMT
fix assertionerror from #6132


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

Branch: refs/heads/cassandra-1.2
Commit: 92b3622dc219798b3bacce6f37eb1d5885bafeb4
Parents: 20a8050
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Oct 3 12:03:02 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Oct 3 12:03:02 2013 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/config/DatabaseDescriptor.java | 3 +++
 src/java/org/apache/cassandra/dht/BootStrapper.java          | 8 ++++----
 src/java/org/apache/cassandra/net/MessagingService.java      | 8 +++++---
 src/java/org/apache/cassandra/service/StorageProxy.java      | 2 +-
 4 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/92b3622d/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 633ea9a..218f719 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.DefsTable;
 import org.apache.cassandra.db.SystemTable;
+import org.apache.cassandra.dht.BootStrapper;
 import org.apache.cassandra.dht.IPartitioner;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.FSWriteError;
@@ -839,6 +840,8 @@ public class DatabaseDescriptor
             case READ_REPAIR:
             case MUTATION:
                 return getWriteRpcTimeout();
+            case BOOTSTRAP_TOKEN:
+                return BootStrapper.BOOTSTRAP_TIMEOUT;
             default:
                 return getRpcTimeout();
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/92b3622d/src/java/org/apache/cassandra/dht/BootStrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java
index ff76534..2e79562 100644
--- a/src/java/org/apache/cassandra/dht/BootStrapper.java
+++ b/src/java/org/apache/cassandra/dht/BootStrapper.java
@@ -48,6 +48,8 @@ import org.apache.cassandra.net.*;
 
 public class BootStrapper
 {
+    public static final long BOOTSTRAP_TIMEOUT = 30000; // default bootstrap timeout of 30s
+
     private static final Logger logger = LoggerFactory.getLogger(BootStrapper.class);
 
     /* endpoint that needs to be bootstrapped */
@@ -55,7 +57,6 @@ public class BootStrapper
     /* token of the node being bootstrapped. */
     protected final Collection<Token> tokens;
     protected final TokenMetadata tokenMetadata;
-    private static final long BOOTSTRAP_TIMEOUT = 30000; // default bootstrap timeout of
30s
 
     public BootStrapper(InetAddress address, Collection<Token> tokens, TokenMetadata
tmd)
     {
@@ -187,13 +188,12 @@ public class BootStrapper
     {
         MessageOut message = new MessageOut(MessagingService.Verb.BOOTSTRAP_TOKEN);
         int retries = 5;
-        long timeout = Math.max(DatabaseDescriptor.getRpcTimeout(), BOOTSTRAP_TIMEOUT);
 
         while (retries > 0)
         {
             BootstrapTokenCallback btc = new BootstrapTokenCallback();
-            MessagingService.instance().sendRR(message, maxEndpoint, btc, timeout);
-            Token token = btc.getToken(timeout);
+            MessagingService.instance().sendRR(message, maxEndpoint, btc);
+            Token token = btc.getToken(BOOTSTRAP_TIMEOUT);
             if (token != null)
                 return token;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/92b3622d/src/java/org/apache/cassandra/net/MessagingService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java
index dd02ca6..c9b0047 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -550,7 +550,7 @@ public final class MessagingService implements MessagingServiceMBean
      */
     public String sendRR(MessageOut message, InetAddress to, IMessageCallback cb)
     {
-        return sendRR(message, to, cb, message.getTimeout());
+        return sendRR(message, to, cb, message.getTimeout(), null);
     }
 
     /**
@@ -567,9 +567,11 @@ public final class MessagingService implements MessagingServiceMBean
      * @param timeout the timeout used for expiration
      * @return an reference to message id used to match with the result
      */
-    public String sendRR(MessageOut message, InetAddress to, IMessageCallback cb, long timeout)
+    public String sendRR(MessageOut message, InetAddress to, IMessageCallback cb, long timeout,
ConsistencyLevel consistencyLevel)
     {
-        String id = addCallback(cb, message, to, timeout);
+        String id = consistencyLevel == null
+                  ? addCallback(cb, message, to, timeout)
+                  : addCallback(cb, message, to, timeout, consistencyLevel);
 
         if (cb instanceof AbstractWriteResponseHandler)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/92b3622d/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java
index a81e5b4..9b559e5 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -642,7 +642,7 @@ public class StorageProxy implements StorageProxyMBean
         {
             // yes, the loop and non-loop code here are the same; this is clunky but we want
to avoid
             // creating a second iterator since we already have a perfectly good one
-            MessagingService.instance().sendRR(message, target, handler);
+            MessagingService.instance().sendRR(message, target, handler, message.getTimeout(),
handler.consistencyLevel);
             while (iter.hasNext())
             {
                 target = iter.next();


Mime
View raw message