You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2019/06/12 14:25:24 UTC

[cassandra] branch cassandra-3.0 updated: Throw IOE instead of asserting on unsupporter peer versions

This is an automated email from the ASF dual-hosted git repository.

aleksey pushed a commit to branch cassandra-3.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-3.0 by this push:
     new 47dfb66  Throw IOE instead of asserting on unsupporter peer versions
47dfb66 is described below

commit 47dfb6642e7fc3e1e3fef57d8c56c3db577e193a
Author: Aleksey Yeshchenko <al...@apple.com>
AuthorDate: Thu May 2 15:51:12 2019 +0100

    Throw IOE instead of asserting on unsupporter peer versions
    
    patch by Aleksey Yeschenko; reviewed by Benedict Elliott Smith for
    CASSANDRA-15066
---
 CHANGES.txt                                                  | 1 +
 src/java/org/apache/cassandra/net/IncomingTcpConnection.java | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 36eb9c2..652833e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.19
+ * Throw IOE instead of asserting on unsupporter peer versions (CASSANDRA-15066)
  * Update token metadata when handling MOVING/REMOVING_TOKEN events (CASSANDRA-15120)
  * Add ability to customize cassandra log directory using $CASSANDRA_LOG_DIR (CASSANDRA-15090)
  * Skip cells with illegal column names when reading legacy sstables (CASSANDRA-15086)
diff --git a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
index de64444..e79da31 100644
--- a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
@@ -141,10 +141,13 @@ public class IncomingTcpConnection extends Thread implements Closeable
         // to connect with, the other node will disconnect
         out.writeInt(MessagingService.current_version);
         out.flush();
+
+        // outbound side will reconnect if necessary to upgrade version
+        if (version > MessagingService.current_version)
+            throw new IOException("Peer-used messaging version " + version + " is larger than max supported " + MessagingService.current_version);
+
         DataInputPlus in = new DataInputStreamPlus(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);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org