You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2014/05/01 11:38:38 UTC

git commit: Fix regression from CASSANDRA-6855

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 68961a6a9 -> 233761e53


Fix regression from CASSANDRA-6855


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

Branch: refs/heads/cassandra-2.1
Commit: 233761e53988301222dfaa590dc7fd8ee396c9b4
Parents: 68961a6
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Thu May 1 11:37:36 2014 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Thu May 1 11:37:36 2014 +0200

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cql3/QueryOptions.java      |  4 +---
 .../cassandra/serializers/CollectionSerializer.java       | 10 ++++++----
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/233761e5/src/java/org/apache/cassandra/cql3/QueryOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/QueryOptions.java b/src/java/org/apache/cassandra/cql3/QueryOptions.java
index 12accaf..5801d55 100644
--- a/src/java/org/apache/cassandra/cql3/QueryOptions.java
+++ b/src/java/org/apache/cassandra/cql3/QueryOptions.java
@@ -58,7 +58,7 @@ public abstract class QueryOptions
 
     public static QueryOptions forInternalCalls(ConsistencyLevel consistency, List<ByteBuffer> values)
     {
-        return new DefaultQueryOptions(consistency, values, false, SpecificOptions.DEFAULT, 0);
+        return new DefaultQueryOptions(consistency, values, false, SpecificOptions.DEFAULT, 3);
     }
 
     public static QueryOptions fromPreV3Batch(ConsistencyLevel consistency)
@@ -123,8 +123,6 @@ public abstract class QueryOptions
 
         private final SpecificOptions options;
 
-        // The protocol version of incoming queries. This is set during deserializaion and will be 0
-        // if the QueryOptions does not come from a user message (or come from thrift).
         private final transient int protocolVersion;
 
         DefaultQueryOptions(ConsistencyLevel consistency, List<ByteBuffer> values, boolean skipMetadata, SpecificOptions options, int protocolVersion)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/233761e5/src/java/org/apache/cassandra/serializers/CollectionSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/serializers/CollectionSerializer.java b/src/java/org/apache/cassandra/serializers/CollectionSerializer.java
index 0e16fda..43b04f3 100644
--- a/src/java/org/apache/cassandra/serializers/CollectionSerializer.java
+++ b/src/java/org/apache/cassandra/serializers/CollectionSerializer.java
@@ -38,15 +38,17 @@ public abstract class CollectionSerializer<T> implements TypeSerializer<T>
     public ByteBuffer serialize(T value)
     {
         List<ByteBuffer> values = serializeValues(value);
-        // The only case we serialize/deserialize collections internally (i.e. not for the protocol sake),
-        // is when collections are in UDT values. There, we use the protocol 3 version since it's more flexible.
+        // See deserialize() for why using the protocol v3 variant is the right thing to do.
         return pack(values, getElementCount(value), 3);
     }
 
     public T deserialize(ByteBuffer bytes)
     {
-        // The only case we serialize/deserialize collections internally (i.e. not for the protocol sake),
-        // is when collections are in UDT values. There, we use the protocol 3 version since it's more flexible.
+        // The only cases we serialize/deserialize collections internally (i.e. not for the protocol sake),
+        // is:
+        //  1) when collections are in UDT values
+        //  2) for internal calls.
+        // In both case, using the protocol 3 version variant is the right thing to do.
         return deserializeForNativeProtocol(bytes, 3);
     }