You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by vi...@apache.org on 2012/02/02 04:44:17 UTC

git commit: fix broadcastAddress and fix for Ec2MultiRegionSnitch.reconnect patch by Vijay; reviewed by Brandon Williams for CASSANDRA-3835

Updated Branches:
  refs/heads/cassandra-1.1 cce15aa0a -> ea3b8da8f


fix broadcastAddress and fix for Ec2MultiRegionSnitch.reconnect
patch by Vijay; reviewed by Brandon Williams for CASSANDRA-3835


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

Branch: refs/heads/cassandra-1.1
Commit: ea3b8da8fb69cb7db665435f07305bdc3c5af6f1
Parents: cce15aa
Author: Vijay Parthasarathy <vi...@gmail.com>
Authored: Wed Feb 1 19:28:24 2012 -0800
Committer: Vijay Parthasarathy <vi...@gmail.com>
Committed: Wed Feb 1 19:28:24 2012 -0800

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cli/CliClient.java   |   10 +---------
 src/java/org/apache/cassandra/db/SystemTable.java  |    2 +-
 src/java/org/apache/cassandra/gms/Gossiper.java    |    2 +-
 .../cassandra/net/OutboundTcpConnection.java       |    5 +++++
 .../cassandra/net/OutboundTcpConnectionPool.java   |    6 ++++--
 5 files changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ea3b8da8/src/java/org/apache/cassandra/cli/CliClient.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliClient.java b/src/java/org/apache/cassandra/cli/CliClient.java
index 4ffa3e9..3f6fa9d 100644
--- a/src/java/org/apache/cassandra/cli/CliClient.java
+++ b/src/java/org/apache/cassandra/cli/CliClient.java
@@ -1150,15 +1150,7 @@ public class CliClient
             {
                 SimpleSnitch snitch = new SimpleSnitch();
                 Map<String, String> options = new HashMap<String, String>();
-
-                try
-                {
-                    options.put(snitch.getDatacenter(InetAddress.getLocalHost()), "1");
-                }
-                catch (UnknownHostException e)
-                {
-                    throw new RuntimeException(e);
-                }
+                options.put(snitch.getDatacenter(FBUtilities.getBroadcastAddress()), "1");
 
                 ksDef.setStrategy_options(options);
             }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ea3b8da8/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 58ff41e..b0b5c60 100644
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@ -143,7 +143,7 @@ public class SystemTable
      */
     public static synchronized void updateToken(InetAddress ep, Token token)
     {
-        if (ep == FBUtilities.getLocalAddress())
+        if (ep == FBUtilities.getBroadcastAddress())
         {
             removeToken(token);
             return;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ea3b8da8/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 27a1ba7..9f73717 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1090,7 +1090,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
      */
     public void addSavedEndpoint(InetAddress ep)
     {
-        if (ep == FBUtilities.getLocalAddress())
+        if (ep == FBUtilities.getBroadcastAddress())
         {
             logger.debug("Attempt to add self as saved endpoint");
             return;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ea3b8da8/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 e920aae..f9d866d 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
@@ -86,6 +86,11 @@ public class OutboundTcpConnection extends Thread
         enqueue(CLOSE_SENTINEL, null);
     }
 
+    void softCloseSocket()
+    {
+        enqueue(CLOSE_SENTINEL, null);
+    }
+
     public void run()
     {
         while (true)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ea3b8da8/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
index c7acd9e..a75dafe 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
@@ -68,7 +68,8 @@ public class OutboundTcpConnectionPool
     public void reset(InetAddress remoteEP)
     {
         resetedEndpoint = remoteEP;
-        reset();
+        for (OutboundTcpConnection con : new OutboundTcpConnection[] { cmdCon, ackCon })
+            con.softCloseSocket();
     }
     
     public Socket newSocket() throws IOException
@@ -78,7 +79,8 @@ public class OutboundTcpConnectionPool
         {
             return SSLFactory.getSocket(DatabaseDescriptor.getEncryptionOptions(), endPoint(), DatabaseDescriptor.getSSLStoragePort(), FBUtilities.getLocalAddress(), 0);
         }
-        else {
+        else 
+        {
             return new Socket(endPoint(), DatabaseDescriptor.getStoragePort(), FBUtilities.getLocalAddress(), 0);
         }
     }