Always use RANGE_SLICE verb for 3.x messages

Patch by Tyler Hobbs; reviewed by Benjamin Lerer for CASSANDRA-12249


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

Branch: refs/heads/cassandra-3.8
Commit: 465def8e295b453dc22430dc4bb7039f6921151e
Parents: 62ef861
Author: Tyler Hobbs <tylerlho...@gmail.com>
Authored: Wed Aug 10 11:09:38 2016 -0500
Committer: Tyler Hobbs <tylerlho...@gmail.com>
Committed: Wed Aug 10 11:09:38 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                             |  2 ++
 src/java/org/apache/cassandra/net/MessageOut.java       |  2 +-
 src/java/org/apache/cassandra/net/MessagingService.java | 10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/465def8e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f613c5f..86746ad 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 3.0.9
+ * Fix potential bad messaging service message for paged range reads
+   within mixed-version 3.x clusters (CASSANDRA-12249)
  * Change commitlog and sstables to track dirty and clean intervals 
(CASSANDRA-11828)
  * NullPointerException during compaction on table with static columns 
(CASSANDRA-12336)
  * Fixed ConcurrentModificationException when reading metrics in 
GraphiteReporter (CASSANDRA-11823)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/465def8e/src/java/org/apache/cassandra/net/MessageOut.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessageOut.java 
b/src/java/org/apache/cassandra/net/MessageOut.java
index a524e7a..ce190cb 100644
--- a/src/java/org/apache/cassandra/net/MessageOut.java
+++ b/src/java/org/apache/cassandra/net/MessageOut.java
@@ -109,7 +109,7 @@ public class MessageOut<T>
     {
         CompactEndpointSerializationHelper.serialize(from, out);
 
-        out.writeInt(verb.ordinal());
+        
out.writeInt(MessagingService.Verb.convertForMessagingServiceVersion(verb, 
version).ordinal());
         out.writeInt(parameters.size());
         for (Map.Entry<String, byte[]> entry : parameters.entrySet())
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/465def8e/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 d01419f..45cfb8a 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -148,6 +148,16 @@ public final class MessagingService implements 
MessagingServiceMBean
         UNUSED_4,
         UNUSED_5,
         ;
+
+        // This is to support a "late" choice of the verb based on the 
messaging service version.
+        // See CASSANDRA-12249 for more details.
+        public static Verb convertForMessagingServiceVersion(Verb verb, int 
version)
+        {
+            if (verb == PAGED_RANGE && version >= VERSION_30)
+                return RANGE_SLICE;
+
+            return verb;
+        }
     }
 
     public static final EnumMap<MessagingService.Verb, Stage> verbStages = new 
EnumMap<MessagingService.Verb, Stage>(MessagingService.Verb.class)

Reply via email to