cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix serialization bug in PagedRangeCommand
Date Tue, 05 Nov 2013 15:33:44 GMT
Updated Branches:
  refs/heads/cassandra-2.0 c28fe7816 -> 20793b069


Fix serialization bug in PagedRangeCommand

patch by slebresne; reviewed by iamaleksey for CASSANDRA-6299


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

Branch: refs/heads/cassandra-2.0
Commit: 20793b069f553c60f0e2c8874f4ae884ea87ea6b
Parents: c28fe78
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Tue Nov 5 16:32:11 2013 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Tue Nov 5 16:32:11 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 .../org/apache/cassandra/db/PagedRangeCommand.java     | 13 +++++++++++--
 .../org/apache/cassandra/db/RangeSliceCommand.java     |  2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/20793b06/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6e9ea33..ddf3e05 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -14,6 +14,7 @@
  * New CQL-aware SSTableWriter (CASSANDRA-5894)
  * Reject CAS operation when the protocol v1 is used (CASSANDRA-6270)
  * Correctly throw error when frame too large (CASSANDRA-5981)
+ * Fix serialization bug in PagedRange with 2ndary indexes (CASSANDRA-6299)
 Merged from 1.2:
  * add non-jamm path for cached statements (CASSANDRA-6293)
  * (Hadoop) Require CFRR batchSize to be at least 2 (CASSANDRA-6114)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/20793b06/src/java/org/apache/cassandra/db/PagedRangeCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/PagedRangeCommand.java b/src/java/org/apache/cassandra/db/PagedRangeCommand.java
index b1e2c39..e152f43 100644
--- a/src/java/org/apache/cassandra/db/PagedRangeCommand.java
+++ b/src/java/org/apache/cassandra/db/PagedRangeCommand.java
@@ -111,6 +111,12 @@ public class PagedRangeCommand extends AbstractRangeCommand
             return cfs.getRangeSlice(exFilter);
     }
 
+    @Override
+    public String toString()
+    {
+        return String.format("PagedRange(%s, %s, %d, %s, %s, %s, %s, %s, %d)", keyspace,
columnFamily, timestamp, keyRange, predicate, start, stop, rowFilter, limit);
+    }
+
     private static class Serializer implements IVersionedSerializer<PagedRangeCommand>
     {
         public void serialize(PagedRangeCommand cmd, DataOutput out, int version) throws
IOException
@@ -134,7 +140,7 @@ public class PagedRangeCommand extends AbstractRangeCommand
             {
                 ByteBufferUtil.writeWithShortLength(expr.column_name, out);
                 out.writeInt(expr.op.getValue());
-                ByteBufferUtil.writeWithLength(expr.value, out);
+                ByteBufferUtil.writeWithShortLength(expr.value, out);
             }
 
             out.writeInt(cmd.limit);
@@ -179,12 +185,15 @@ public class PagedRangeCommand extends AbstractRangeCommand
 
             size += SliceQueryFilter.serializer.serializedSize((SliceQueryFilter)cmd.predicate,
version);
 
+            size += TypeSizes.NATIVE.sizeofWithShortLength(cmd.start);
+            size += TypeSizes.NATIVE.sizeofWithShortLength(cmd.stop);
+
             size += TypeSizes.NATIVE.sizeof(cmd.rowFilter.size());
             for (IndexExpression expr : cmd.rowFilter)
             {
                 size += TypeSizes.NATIVE.sizeofWithShortLength(expr.column_name);
                 size += TypeSizes.NATIVE.sizeof(expr.op.getValue());
-                size += TypeSizes.NATIVE.sizeofWithLength(expr.value);
+                size += TypeSizes.NATIVE.sizeofWithShortLength(expr.value);
             }
 
             size += TypeSizes.NATIVE.sizeof(cmd.limit);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/20793b06/src/java/org/apache/cassandra/db/RangeSliceCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/RangeSliceCommand.java b/src/java/org/apache/cassandra/db/RangeSliceCommand.java
index c0cfb12..4aa1595 100644
--- a/src/java/org/apache/cassandra/db/RangeSliceCommand.java
+++ b/src/java/org/apache/cassandra/db/RangeSliceCommand.java
@@ -310,7 +310,7 @@ class RangeSliceCommandSerializer implements IVersionedSerializer<RangeSliceComm
             {
                 size += TypeSizes.NATIVE.sizeofWithShortLength(expr.column_name);
                 size += TypeSizes.NATIVE.sizeof(expr.op.getValue());
-                size += TypeSizes.NATIVE.sizeofWithLength(expr.value);
+                size += TypeSizes.NATIVE.sizeofWithShortLength(expr.value);
             }
         }
         size += AbstractBounds.serializer.serializedSize(rsc.keyRange, version);


Mime
View raw message