cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/6] git commit: serializedSize fixes patch by yukim; reviewed by jbellis for CASSANDRA-4247
Date Sat, 19 May 2012 22:34:54 GMT
serializedSize fixes
patch by yukim; reviewed by jbellis for CASSANDRA-4247


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

Branch: refs/heads/trunk
Commit: 4a3fa3c85ac4bebbc430eaec36c5e0aa67236c85
Parents: f211e50
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri May 18 17:04:09 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Sat May 19 17:32:19 2012 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/RowPosition.java  |    4 ++--
 .../cassandra/db/SliceByNamesReadCommand.java      |    3 +--
 .../apache/cassandra/streaming/PendingFile.java    |    4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4a3fa3c8/src/java/org/apache/cassandra/db/RowPosition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/RowPosition.java b/src/java/org/apache/cassandra/db/RowPosition.java
index 6efd90c..ca2954b 100644
--- a/src/java/org/apache/cassandra/db/RowPosition.java
+++ b/src/java/org/apache/cassandra/db/RowPosition.java
@@ -103,11 +103,11 @@ public abstract class RowPosition implements RingPosition<RowPosition>
             if (kind == Kind.ROW_KEY)
             {
                 int keySize = ((DecoratedKey)pos).key.remaining();
-                size += (typeSizes.sizeof((short) keySize) + keySize);
+                size += typeSizes.sizeof((short) keySize) + keySize;
             }
             else
             {
-                Token.serializer.serializedSize(pos.getToken(), typeSizes);
+                size += Token.serializer.serializedSize(pos.getToken(), typeSizes);
             }
             return size;
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4a3fa3c8/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java b/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
index 1f92890..8f68d1a 100644
--- a/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
+++ b/src/java/org/apache/cassandra/db/SliceByNamesReadCommand.java
@@ -27,7 +27,6 @@ import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.ColumnParent;
 import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.FBUtilities;
 
 public class SliceByNamesReadCommand extends ReadCommand
 {
@@ -116,7 +115,7 @@ class SliceByNamesReadCommandSerializer implements IVersionedSerializer<ReadComm
         int keySize = command.key.remaining();
 
         size += sizes.sizeof(command.table);
-        size += sizes.sizeof(keySize) + keySize;
+        size += sizes.sizeof((short)keySize) + keySize;
         size += command.queryPath.serializedSize(sizes);
         size += sizes.sizeof(command.columnNames.size());
         if (!command.columnNames.isEmpty())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4a3fa3c8/src/java/org/apache/cassandra/streaming/PendingFile.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/PendingFile.java b/src/java/org/apache/cassandra/streaming/PendingFile.java
index 8160f51..8aa4b41 100644
--- a/src/java/org/apache/cassandra/streaming/PendingFile.java
+++ b/src/java/org/apache/cassandra/streaming/PendingFile.java
@@ -146,13 +146,13 @@ public class PendingFile
         public long serializedSize(PendingFile pf, int version)
         {
             if (pf == null)
-                return TypeSizes.NATIVE.sizeof(0);
+                return TypeSizes.NATIVE.sizeof("");
 
             long size = TypeSizes.NATIVE.sizeof(pf.desc.filenameFor(pf.component));
             size += TypeSizes.NATIVE.sizeof(pf.component);
             size += TypeSizes.NATIVE.sizeof(pf.sections.size());
             for (Pair<Long,Long> section : pf.sections)
-                size += TypeSizes.NATIVE.sizeof(section.left + TypeSizes.NATIVE.sizeof(section.right));
+                size += TypeSizes.NATIVE.sizeof(section.left) + TypeSizes.NATIVE.sizeof(section.right);
             if (version > MessagingService.VERSION_07)
                 size += TypeSizes.NATIVE.sizeof(pf.type.name());
             if (version > MessagingService.VERSION_080)


Mime
View raw message