cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [1/6] cassandra git commit: don't block SocketThread for MessagingService
Date Mon, 01 Dec 2014 19:45:14 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 54b4b99e1 -> eb0424ecd
  refs/heads/cassandra-2.1 dd1dd8eb7 -> c8848bc5b
  refs/heads/trunk 986b7a603 -> a10944199


don't block SocketThread for MessagingService

Patch by yangwei, reviewed by brandonwilliams for CASSANDRA-8188


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

Branch: refs/heads/cassandra-2.0
Commit: eb0424ecdef4fae4dd54050862c096b9976a9b01
Parents: 54b4b99
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Mon Dec 1 13:43:16 2014 -0600
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Mon Dec 1 13:44:28 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                                  | 1 +
 src/java/org/apache/cassandra/net/MessagingService.java      | 2 ++
 src/java/org/apache/cassandra/net/OutboundTcpConnection.java | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb0424ec/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 57c0a26..3febed0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.12:
+ * don't block SocketThread for MessagingService (CASSANDRA-8188)
  * Increase quarantine delay on replacement (CASSANDRA-8260)
  * Expose off-heap memory usage stats (CASSANDRA-7897)
  * Ignore Paxos commits for truncated tables (CASSANDRA-7538)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb0424ec/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 d2e65d8..117bd3c 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -908,6 +908,7 @@ public final class MessagingService implements MessagingServiceMBean
                     }
 
                     socket.setKeepAlive(true);
+                    socket.setSoTimeout(2 * OutboundTcpConnection.WAIT_FOR_VERSION_MAX_TIME);
                     // determine the connection type to decide whether to buffer
                     DataInputStream in = new DataInputStream(socket.getInputStream());
                     MessagingService.validateMagic(in.readInt());
@@ -915,6 +916,7 @@ public final class MessagingService implements MessagingServiceMBean
                     boolean isStream = MessagingService.getBits(header, 3, 1) == 1;
                     int version = MessagingService.getBits(header, 15, 8);
                     logger.debug("Connection version {} from {}", version, socket.getInetAddress());
+                    socket.setSoTimeout(0);
 
                     Thread thread = isStream
                                   ? new IncomingStreamingConnection(version, socket)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eb0424ec/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
index c1de563..ac9a1fb 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
@@ -55,7 +55,7 @@ public class OutboundTcpConnection extends Thread
     private volatile boolean isStopped = false;
 
     private static final int OPEN_RETRY_DELAY = 100; // ms between retries
-    private static final int WAIT_FOR_VERSION_MAX_TIME = 5000;
+    public static final int WAIT_FOR_VERSION_MAX_TIME = 5000;
     private static final int NO_VERSION = Integer.MIN_VALUE;
 
     // sending thread reads from "active" (one of queue1, queue2) until it is empty.


Mime
View raw message