cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [6/9] cassandra git commit: Fix code to not exchange schema across major versions
Date Tue, 28 Mar 2017 07:48:12 GMT
Fix code to not exchange schema across major versions

patch by Robert Stupp; reviewed by Sylvain Lebresne for CASSANDRA-13274


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

Branch: refs/heads/cassandra-3.0
Commit: 6da41ed047ed5ef8a5d11e7a60e73dfeb129a72a
Parents: 5262bb1
Author: Robert Stupp <snazy@snazy.de>
Authored: Tue Mar 28 09:35:49 2017 +0200
Committer: Robert Stupp <snazy@snazy.de>
Committed: Tue Mar 28 09:35:49 2017 +0200

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 src/java/org/apache/cassandra/net/MessagingService.java | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6da41ed0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0b1bb01..0af7a7d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.13
+ * Fix code to not exchange schema across major versions (CASSANDRA-13274)
  * Dropping column results in "corrupt" SSTable (CASSANDRA-13337)
  * Bugs handling range tombstones in the sstable iterators (CASSANDRA-13340)
  * Fix CONTAINS filtering for null collections (CASSANDRA-13246)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6da41ed0/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 e8095d3..4aaf49b 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -903,9 +903,6 @@ public final class MessagingService implements MessagingServiceMBean
      */
     public int setVersion(InetAddress endpoint, int version)
     {
-        // We can't talk to someone from the future
-        version = Math.min(version, current_version);
-
         logger.trace("Setting version {} for {}", version, endpoint);
 
         if (version < VERSION_22)
@@ -926,7 +923,7 @@ public final class MessagingService implements MessagingServiceMBean
     {
         logger.trace("Resetting version for {}", endpoint);
         Integer removed = versions.remove(endpoint);
-        if (removed != null && removed <= VERSION_30)
+        if (removed != null && Math.min(removed, current_version) <= VERSION_30)
             refreshAllNodeMinVersions();
     }
 
@@ -951,6 +948,10 @@ public final class MessagingService implements MessagingServiceMBean
         allNodesAtLeast30 = !anyNodeLowerThan30;
     }
 
+    /**
+     * Returns the messaging-version as announced by the given node but capped
+     * to the min of the version as announced by the node and {@link #current_version}.
+     */
     public int getVersion(InetAddress endpoint)
     {
         Integer v = versions.get(endpoint);
@@ -969,6 +970,9 @@ public final class MessagingService implements MessagingServiceMBean
         return getVersion(InetAddress.getByName(endpoint));
     }
 
+    /**
+     * Returns the messaging-version exactly as announced by the given endpoint.
+     */
     public int getRawVersion(InetAddress endpoint)
     {
         Integer v = versions.get(endpoint);


Mime
View raw message