Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 26C2C17EB7 for ; Tue, 12 May 2015 15:57:05 +0000 (UTC) Received: (qmail 98403 invoked by uid 500); 12 May 2015 15:57:04 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 98360 invoked by uid 500); 12 May 2015 15:57:04 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 98345 invoked by uid 99); 12 May 2015 15:57:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2015 15:57:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A7D1CE0329; Tue, 12 May 2015 15:57:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbellis@apache.org To: commits@cassandra.apache.org Date: Tue, 12 May 2015 15:57:04 -0000 Message-Id: <53cb9296d7504b7997994c2cba30bd01@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/6] cassandra git commit: Fix ReconnectableSnitch reconnecting to peers during upgrade 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 Authored: Tue May 12 10:55:43 2015 -0500 Committer: Jonathan Ellis 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());