cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/6] cassandra git commit: Fix ReconnectableSnitch reconnecting to peers during upgrade
Date Tue, 12 May 2015 15:57:04 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 15235ee63 -> a7cae3255
  refs/heads/cassandra-2.1 ed0026fed -> 2e7b0884a
  refs/heads/trunk fa4a020ac -> 5ff69f2c9


Fix ReconnectableSnitch reconnecting to peers during upgrade


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

Branch: refs/heads/cassandra-2.0
Commit: a7cae3255cc7a8014804c7642eaefc6f35099a3e
Parents: 15235ee
Author: Blake Eggleston <bdeggleston@gmail.com>
Authored: Tue May 12 10:55:43 2015 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue May 12 10:56:04 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                           |  1 +
 .../cassandra/locator/ReconnectableSnitchHelper.java  |  1 -
 .../apache/cassandra/net/IncomingTcpConnection.java   | 14 ++++----------
 3 files changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a7cae325/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d3715c4..685b945 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.15:
+ * Fix ReconnectableSnitch reconnecting to peers during upgrade (CASSANDRA-6702)
  * Include keyspace and table name in error log for collections over the size
    limit (CASSANDRA-9286)
  * Avoid potential overlap in LCS with single-partition sstables (CASSANDRA-9322)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a7cae325/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java b/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java
index e5dbdeb..3277af7 100644
--- a/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java
+++ b/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java
@@ -60,7 +60,6 @@ public class ReconnectableSnitchHelper implements IEndpointStateChangeSubscriber
     private void reconnect(InetAddress publicAddress, InetAddress localAddress)
     {
         if (snitch.getDatacenter(publicAddress).equals(localDc)
-                && MessagingService.instance().getVersion(publicAddress) == MessagingService.current_version
                 && !MessagingService.instance().getConnectionPool(publicAddress).endPoint().equals(localAddress))
         {
             MessagingService.instance().getConnectionPool(publicAddress).reset(localAddress);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a7cae325/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
index b61e82e..4817c75 100644
--- a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
@@ -119,11 +119,14 @@ public class IncomingTcpConnection extends Thread implements Closeable
     {
         // handshake (true) endpoint versions
         DataOutputStream out = new DataOutputStream(socket.getOutputStream());
+        // if this version is < the MS version the other node is trying
+        // to connect with, the other node will disconnect
         out.writeInt(MessagingService.current_version);
         out.flush();
         DataInputStream in = new DataInputStream(socket.getInputStream());
         int maxVersion = in.readInt();
-
+        // outbound side will reconnect if necessary to upgrade version
+        assert version <= MessagingService.current_version;
         from = CompactEndpointSerializationHelper.deserialize(in);
         // record the (true) version of the endpoint
         MessagingService.instance().setVersion(from, maxVersion);
@@ -139,15 +142,6 @@ public class IncomingTcpConnection extends Thread implements Closeable
             in = new DataInputStream(new BufferedInputStream(socket.getInputStream(), 4096));
         }
 
-        if (version > MessagingService.current_version)
-        {
-            // save the endpoint so gossip will reconnect to it
-            Gossiper.instance.addSavedEndpoint(from);
-            logger.info("Received messages from newer protocol version {}. Ignoring", version);
-            return;
-        }
-        // outbound side will reconnect if necessary to upgrade version
-
         while (true)
         {
             MessagingService.validateMagic(in.readInt());


Mime
View raw message