cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [6/15] git commit: add serializedSize (part 2) and fix unit tests patch by yukim; reviewed by jbellis for CASSANDRA-3617
Date Tue, 08 May 2012 17:56:15 GMT
add serializedSize (part 2) and fix unit tests
patch by yukim; reviewed by jbellis for CASSANDRA-3617


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

Branch: refs/heads/trunk
Commit: f81cc74f5cb749cb68b34c724f50b1200dcf3ad6
Parents: 5b9fc26
Author: Yuki Morishita <mor.yuki@gmail.com>
Authored: Mon Apr 2 13:32:27 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue May 8 12:40:55 2012 -0500

----------------------------------------------------------------------
 build.xml                                          |    6 +
 .../org/apache/cassandra/db/RangeSliceCommand.java |   62 +++++++++++-
 .../cassandra/db/SchemaCheckVerbHandler.java       |    7 +-
 .../org/apache/cassandra/db/SnapshotCommand.java   |   12 ++-
 .../org/apache/cassandra/db/TruncateResponse.java  |   20 +++--
 src/java/org/apache/cassandra/db/Truncation.java   |    5 +-
 .../org/apache/cassandra/dht/BootStrapper.java     |    4 +-
 src/java/org/apache/cassandra/dht/Token.java       |    4 +-
 .../cassandra/net/IncomingTcpConnection.java       |    2 +-
 src/java/org/apache/cassandra/net/MessageIn.java   |   10 +--
 src/java/org/apache/cassandra/net/MessageOut.java  |   15 ++-
 .../apache/cassandra/service/MigrationTask.java    |   46 ++++-----
 .../apache/cassandra/streaming/FileStreamTask.java |    3 +-
 .../org/apache/cassandra/utils/MerkleTree.java     |    2 +-
 .../serialization/1.2/db.RangeSliceCommand.bin     |  Bin 0 -> 819 bytes
 test/data/serialization/1.2/db.Row.bin             |  Bin 0 -> 495 bytes
 test/data/serialization/1.2/db.RowMutation.bin     |  Bin 0 -> 3266 bytes
 .../1.2/db.SliceByNamesReadCommand.bin             |  Bin 0 -> 367 bytes
 .../serialization/1.2/db.SliceFromReadCommand.bin  |  Bin 0 -> 361 bytes
 test/data/serialization/1.2/db.Truncation.bin      |  Bin 0 -> 257 bytes
 test/data/serialization/1.2/db.WriteResponse.bin   |  Bin 0 -> 38 bytes
 test/data/serialization/1.2/gms.EndpointState.bin  |  Bin 0 -> 73 bytes
 test/data/serialization/1.2/gms.Gossip.bin         |  Bin 0 -> 109 bytes
 .../data/serialization/1.2/service.TreeRequest.bin |  Bin 0 -> 121 bytes
 .../serialization/1.2/service.TreeResponse.bin     |  Bin 0 -> 930 bytes
 .../serialization/1.2/streaming.PendingFile.bin    |  Bin 0 -> 3466 bytes
 .../serialization/1.2/streaming.StreamHeader.bin   |  Bin 0 -> 175486 bytes
 .../serialization/1.2/streaming.StreamReply.bin    |  Bin 0 -> 73 bytes
 .../1.2/streaming.StreamRequestMessage.bin         |  Bin 0 -> 7127 bytes
 test/data/serialization/1.2/utils.BloomFilter.bin  |  Bin 0 -> 2500016 bytes
 .../serialization/1.2/utils.EstimatedHistogram.bin |  Bin 0 -> 97500 bytes
 .../serialization/1.2/utils.LegacyBloomFilter.bin  |  Bin 0 -> 5000170 bytes
 .../cassandra/AbstractSerializationsTester.java    |   21 +++-
 .../apache/cassandra/db/SerializationsTest.java    |   80 +++++++++++----
 .../apache/cassandra/gms/SerializationsTest.java   |   18 +++-
 .../apache/cassandra/io/CompactSerializerTest.java |   22 +++--
 .../org/apache/cassandra/service/RemoveTest.java   |    4 +-
 .../cassandra/service/SerializationsTest.java      |   14 ++-
 .../cassandra/streaming/SerializationsTest.java    |   26 ++++-
 .../apache/cassandra/utils/SerializationsTest.java |    7 +-
 40 files changed, 280 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index f24ef68..7330862 100644
--- a/build.xml
+++ b/build.xml
@@ -1118,6 +1118,12 @@
     </testmacro>
   </target>
 
+  <target name="msg-ser-test-10" depends="build-test" description="Tests message serializations on 1.0 messages">
+    <testmacro suitename="unit" inputdir="${test.unit.src}" 
+               timeout="60000" filter="**/SerializationsTest.java">
+      <jvmarg value="-Dcassandra.version=1.0"/>
+    </testmacro>
+  </target>
 
   <target name="long-test" depends="build-test" description="Execute functional tests">
     <testmacro suitename="long" inputdir="${test.long.src}"

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/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 f029ae7..ecf1636 100644
--- a/src/java/org/apache/cassandra/db/RangeSliceCommand.java
+++ b/src/java/org/apache/cassandra/db/RangeSliceCommand.java
@@ -57,6 +57,7 @@ import org.apache.cassandra.thrift.TBinaryProtocol;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.thrift.TDeserializer;
+import org.apache.thrift.TException;
 import org.apache.thrift.TSerializer;
 
 public class RangeSliceCommand implements IReadCommand
@@ -221,6 +222,65 @@ class RangeSliceCommandSerializer implements IVersionedSerializer<RangeSliceComm
 
     public long serializedSize(RangeSliceCommand rangeSliceCommand, int version)
     {
-        throw new UnsupportedOperationException();
+        int ksLength = FBUtilities.encodedUTF8Length(rangeSliceCommand.keyspace);
+        long size = DBTypeSizes.NATIVE.sizeof(ksLength) + ksLength;
+        int cfLength = FBUtilities.encodedUTF8Length(rangeSliceCommand.column_family);
+        size += DBTypeSizes.NATIVE.sizeof(cfLength) + cfLength;
+
+        ByteBuffer sc = rangeSliceCommand.super_column;
+        if (sc != null)
+        {
+            size += DBTypeSizes.NATIVE.sizeof(sc.remaining());
+            size += sc.remaining();
+        }
+        else
+        {
+            size += DBTypeSizes.NATIVE.sizeof(0);
+        }
+
+        TSerializer ser = new TSerializer(new TBinaryProtocol.Factory());
+        try
+        {
+            int predicateLength = ser.serialize(rangeSliceCommand.predicate).length;
+            size += DBTypeSizes.NATIVE.sizeof(predicateLength);
+            size += predicateLength;
+        }
+        catch (TException e)
+        {
+            throw new RuntimeException(e);
+        }
+
+        if (version >= MessagingService.VERSION_11)
+        {
+            if (rangeSliceCommand.row_filter == null)
+            {
+                size += DBTypeSizes.NATIVE.sizeof(0);
+            }
+            else
+            {
+                size += DBTypeSizes.NATIVE.sizeof(rangeSliceCommand.row_filter.size());
+                for (IndexExpression expr : rangeSliceCommand.row_filter)
+                {
+                    try
+                    {
+                        int filterLength = ser.serialize(expr).length;
+                        size += DBTypeSizes.NATIVE.sizeof(filterLength);
+                        size += filterLength;
+                    }
+                    catch (TException e)
+                    {
+                        throw new RuntimeException(e);
+                    }
+                }
+            }
+        }
+        size += AbstractBounds.serializer().serializedSize(rangeSliceCommand.range, version);
+        size += DBTypeSizes.NATIVE.sizeof(rangeSliceCommand.maxResults);
+        if (version >= MessagingService.VERSION_11)
+        {
+            size += DBTypeSizes.NATIVE.sizeof(rangeSliceCommand.maxIsColumns);
+            size += DBTypeSizes.NATIVE.sizeof(rangeSliceCommand.isPaging);
+        }
+        return size;
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java b/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
index d33419e..4251512 100644
--- a/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
+++ b/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
@@ -17,6 +17,10 @@
  */
 package org.apache.cassandra.db;
 
+import java.util.UUID;
+
+import org.apache.cassandra.config.Schema;
+import org.apache.cassandra.utils.UUIDGen;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -25,7 +29,6 @@ import org.apache.cassandra.net.MessageIn;
 import org.apache.cassandra.net.MessageOut;
 import org.apache.cassandra.net.MessagingService;
 
-
 public class SchemaCheckVerbHandler implements IVerbHandler
 {
     private final Logger logger = LoggerFactory.getLogger(SchemaCheckVerbHandler.class);
@@ -33,7 +36,7 @@ public class SchemaCheckVerbHandler implements IVerbHandler
     public void doVerb(MessageIn message, String id)
     {
         logger.debug("Received schema check request.");
-        MessageOut response = new MessageOut(MessagingService.Verb.INTERNAL_RESPONSE);
+        MessageOut<UUID> response = new MessageOut<UUID>(MessagingService.Verb.INTERNAL_RESPONSE, Schema.instance.getVersion(), UUIDGen.serializer);
         MessagingService.instance().sendReply(response, id, message.from);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/db/SnapshotCommand.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SnapshotCommand.java b/src/java/org/apache/cassandra/db/SnapshotCommand.java
index 623d5c2..ac2fe4f 100644
--- a/src/java/org/apache/cassandra/db/SnapshotCommand.java
+++ b/src/java/org/apache/cassandra/db/SnapshotCommand.java
@@ -27,10 +27,13 @@ import org.apache.cassandra.io.util.FastByteArrayInputStream;
 import org.apache.cassandra.net.MessageIn;
 import org.apache.cassandra.net.MessageOut;
 import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.utils.FBUtilities;
+
+import static org.apache.cassandra.utils.FBUtilities.serializedUTF8Size;
 
 public class SnapshotCommand
 {
-    private static final SnapshotCommandSerializer serializer = new SnapshotCommandSerializer();
+    public static final SnapshotCommandSerializer serializer = new SnapshotCommandSerializer();
 
     public final String keyspace;
     public final String column_family;
@@ -79,8 +82,11 @@ class SnapshotCommandSerializer implements IVersionedSerializer<SnapshotCommand>
         return new SnapshotCommand(keyspace, column_family, snapshot_name, clear_snapshot);
     }
 
-    public long serializedSize(SnapshotCommand snapshot_command, int version)
+    public long serializedSize(SnapshotCommand sc, int version)
     {
-        throw new UnsupportedOperationException();
+        return serializedUTF8Size(sc.keyspace)
+             + serializedUTF8Size(sc.column_family)
+             + serializedUTF8Size(sc.snapshot_name)
+             + DBTypeSizes.NATIVE.sizeof(sc.clear_snapshot);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/db/TruncateResponse.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/TruncateResponse.java b/src/java/org/apache/cassandra/db/TruncateResponse.java
index eb5cb08..4dd580f 100644
--- a/src/java/org/apache/cassandra/db/TruncateResponse.java
+++ b/src/java/org/apache/cassandra/db/TruncateResponse.java
@@ -24,6 +24,9 @@ import java.io.IOException;
 import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.net.MessageOut;
 import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.utils.FBUtilities;
+
+import static org.apache.cassandra.utils.FBUtilities.serializedUTF8Size;
 
 
 /**
@@ -43,11 +46,12 @@ public class TruncateResponse
     public final String columnFamily;
     public final boolean success;
 
-    public TruncateResponse(String keyspace, String columnFamily, boolean success) {
-		this.keyspace = keyspace;
-		this.columnFamily = columnFamily;
-		this.success = success;
-	}
+    public TruncateResponse(String keyspace, String columnFamily, boolean success)
+    {
+        this.keyspace = keyspace;
+        this.columnFamily = columnFamily;
+        this.success = success;
+    }
 
     public MessageOut<TruncateResponse> createMessage()
     {
@@ -71,9 +75,11 @@ public class TruncateResponse
             return new TruncateResponse(keyspace, columnFamily, success);
         }
 
-        public long serializedSize(TruncateResponse truncateResponse, int version)
+        public long serializedSize(TruncateResponse tr, int version)
         {
-            throw new UnsupportedOperationException();
+            return serializedUTF8Size(tr.keyspace)
+                 + serializedUTF8Size(tr.columnFamily)
+                 + DBTypeSizes.NATIVE.sizeof(tr.success);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/db/Truncation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Truncation.java b/src/java/org/apache/cassandra/db/Truncation.java
index afb115b..787399c 100644
--- a/src/java/org/apache/cassandra/db/Truncation.java
+++ b/src/java/org/apache/cassandra/db/Truncation.java
@@ -24,6 +24,9 @@ import java.io.IOException;
 import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.net.MessageOut;
 import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.utils.FBUtilities;
+
+import static org.apache.cassandra.utils.FBUtilities.serializedUTF8Size;
 
 /**
  * A truncate operation descriptor
@@ -79,6 +82,6 @@ class TruncationSerializer implements IVersionedSerializer<Truncation>
 
     public long serializedSize(Truncation truncation, int version)
     {
-        throw new UnsupportedOperationException();
+        return serializedUTF8Size(truncation.keyspace) + serializedUTF8Size(truncation.columnFamily);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/dht/BootStrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/BootStrapper.java b/src/java/org/apache/cassandra/dht/BootStrapper.java
index d6fdf68..7886304 100644
--- a/src/java/org/apache/cassandra/dht/BootStrapper.java
+++ b/src/java/org/apache/cassandra/dht/BootStrapper.java
@@ -25,7 +25,6 @@ import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
 
-import com.google.common.base.Charsets;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -43,6 +42,7 @@ import org.apache.cassandra.streaming.OperationType;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.SimpleCondition;
 
+import static org.apache.cassandra.utils.FBUtilities.serializedUTF8Size;
 
 public class BootStrapper
 {
@@ -230,7 +230,7 @@ public class BootStrapper
 
         public long serializedSize(String s, int version)
         {
-            return 2 + FBUtilities.encodedUTF8Length(s);
+            return serializedUTF8Size(s);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/dht/Token.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/Token.java b/src/java/org/apache/cassandra/dht/Token.java
index bf80b3c..e30338c 100644
--- a/src/java/org/apache/cassandra/dht/Token.java
+++ b/src/java/org/apache/cassandra/dht/Token.java
@@ -105,7 +105,9 @@ public abstract class Token<T> implements RingPosition<Token<T>>, Serializable
 
         public long serializedSize(Token object, DBTypeSizes typeSizes)
         {
-            throw new UnsupportedOperationException();
+            IPartitioner p = StorageService.getPartitioner();
+            ByteBuffer b = p.getTokenFactory().toByteArray(object);
+            return DBTypeSizes.NATIVE.sizeof(b.remaining()) + b.remaining();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
index 45d8255..56bb0a3 100644
--- a/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
@@ -64,7 +64,6 @@ public class IncomingTcpConnection extends Thread
             int header = input.readInt();
             isStream = MessagingService.getBits(header, 3, 1) == 1;
             version = MessagingService.getBits(header, 15, 8);
-            logger.debug("Version for {} is {}", from, version);
             if (isStream)
             {
                 if (version == MessagingService.current_version)
@@ -88,6 +87,7 @@ public class IncomingTcpConnection extends Thread
             input = new DataInputStream(new BufferedInputStream(socket.getInputStream(), 4096));
             // Receive the first message to set the version.
             from = receiveMessage(input, version); // why? see => CASSANDRA-4099
+            logger.debug("Version for {} is {}", from, version);
             if (version > MessagingService.current_version)
             {
                 // save the endpoint so gossip will reconnect to it

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/net/MessageIn.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessageIn.java b/src/java/org/apache/cassandra/net/MessageIn.java
index fe053a4..531e0dd 100644
--- a/src/java/org/apache/cassandra/net/MessageIn.java
+++ b/src/java/org/apache/cassandra/net/MessageIn.java
@@ -75,8 +75,6 @@ public class MessageIn<T>
         }
 
         int payloadSize = in.readInt();
-        if (payloadSize == 0)
-            return create(from, null, parameters, verb, version);
         IVersionedSerializer<T2> serializer = (IVersionedSerializer<T2>) MessagingService.verbSerializers.get(verb);
         if (serializer instanceof MessagingService.CallbackDeterminedSerializer)
         {
@@ -89,6 +87,8 @@ public class MessageIn<T>
             }
             serializer = (IVersionedSerializer<T2>) callback.serializer;
         }
+        if (payloadSize == 0 || serializer == null)
+            return create(from, null, parameters, verb, version);
         T2 payload = serializer.deserialize(in, version);
         return MessageIn.create(from, payload, parameters, verb, version);
     }
@@ -101,11 +101,7 @@ public class MessageIn<T>
     public String toString()
     {
         StringBuilder sbuf = new StringBuilder("");
-        String separator = System.getProperty("line.separator");
-        sbuf.append("FROM:").append(from)
-            .append(separator).append("TYPE:").append(getMessageType())
-            .append(separator).append("VERB:").append(verb)
-        	.append(separator);
+        sbuf.append("FROM:").append(from).append(" TYPE:").append(getMessageType()).append(" VERB:").append(verb);
         return sbuf.toString();
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/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 510223d..1d5c34c 100644
--- a/src/java/org/apache/cassandra/net/MessageOut.java
+++ b/src/java/org/apache/cassandra/net/MessageOut.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.net;
 
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.net.InetAddress;
 import java.util.Collections;
 import java.util.Map;
 
@@ -31,6 +32,7 @@ import org.apache.cassandra.utils.FBUtilities;
 
 public class MessageOut<T>
 {
+    public final InetAddress from;
     public final MessagingService.Verb verb;
     public final T payload;
     public final IVersionedSerializer<T> serializer;
@@ -49,6 +51,12 @@ public class MessageOut<T>
 
     public MessageOut(MessagingService.Verb verb, T payload, IVersionedSerializer<T> serializer, Map<String, byte[]> parameters)
     {
+        this(FBUtilities.getBroadcastAddress(), verb, payload, serializer, parameters);
+    }
+
+    public MessageOut(InetAddress from, MessagingService.Verb verb, T payload, IVersionedSerializer<T> serializer, Map<String, byte[]> parameters)
+    {
+        this.from = from;
         this.verb = verb;
         this.payload = payload;
         this.serializer = serializer;
@@ -81,16 +89,13 @@ public class MessageOut<T>
     public String toString()
     {
         StringBuilder sbuf = new StringBuilder("");
-        String separator = System.getProperty("line.separator");
-        sbuf.append("TYPE:").append(getStage())
-            .append(separator).append("VERB:").append(verb)
-        	.append(separator);
+        sbuf.append("TYPE:").append(getStage()).append(" VERB:").append(verb);
         return sbuf.toString();
     }
 
     public void serialize(DataOutputStream out, int version) throws IOException
     {
-        CompactEndpointSerializationHelper.serialize(FBUtilities.getBroadcastAddress(), out);
+        CompactEndpointSerializationHelper.serialize(from, out);
 
         out.writeInt(verb.ordinal());
         out.writeInt(parameters.size());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/service/MigrationTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/MigrationTask.java b/src/java/org/apache/cassandra/service/MigrationTask.java
index ee39b82..28945b1 100644
--- a/src/java/org/apache/cassandra/service/MigrationTask.java
+++ b/src/java/org/apache/cassandra/service/MigrationTask.java
@@ -1,8 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.cassandra.service;
 
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
 import java.net.InetAddress;
 import java.util.Collection;
 import java.util.concurrent.TimeUnit;
@@ -15,8 +29,6 @@ import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.DefsTable;
 import org.apache.cassandra.db.RowMutation;
 import org.apache.cassandra.gms.FailureDetector;
-import org.apache.cassandra.gms.Gossiper;
-import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.net.IAsyncResult;
 import org.apache.cassandra.net.MessageOut;
 import org.apache.cassandra.net.MessagingService;
@@ -26,8 +38,6 @@ class MigrationTask extends WrappedRunnable
 {
     private static final Logger logger = LoggerFactory.getLogger(MigrationTask.class);
 
-    private static final MigrationTaskSerializer serializer = new MigrationTaskSerializer();
-
     private final InetAddress endpoint;
 
     MigrationTask(InetAddress endpoint)
@@ -37,9 +47,7 @@ class MigrationTask extends WrappedRunnable
 
     public void runMayThrow() throws Exception
     {
-        MessageOut<MigrationTask> message = new MessageOut<MigrationTask>(MessagingService.Verb.MIGRATION_REQUEST,
-                                                                          this,
-                                                                          serializer);
+        MessageOut message = new MessageOut(MessagingService.Verb.MIGRATION_REQUEST, null, MigrationManager.MigrationsSerializer.instance);
 
         int retries = 0;
         while (retries < MigrationManager.MIGRATION_REQUEST_RETRIES)
@@ -63,22 +71,4 @@ class MigrationTask extends WrappedRunnable
             }
         }
     }
-
-    private static class MigrationTaskSerializer implements IVersionedSerializer<MigrationTask>
-    {
-        public void serialize(MigrationTask task, DataOutput out, int version) throws IOException
-        {
-            // all recipient needs is our reply-to address, which it gets from the connection
-        }
-
-        public MigrationTask deserialize(DataInput in, int version) throws IOException
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        public long serializedSize(MigrationTask migrationTask, int version)
-        {
-            return 0;
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/streaming/FileStreamTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/FileStreamTask.java b/src/java/org/apache/cassandra/streaming/FileStreamTask.java
index 5cb7c7e..65d18f5 100644
--- a/src/java/org/apache/cassandra/streaming/FileStreamTask.java
+++ b/src/java/org/apache/cassandra/streaming/FileStreamTask.java
@@ -195,7 +195,8 @@ public class FileStreamTask extends WrappedRunnable
         assert MessagingService.getBits(msheader, 3, 1) == 0 : "Stream received before stream reply";
         int version = MessagingService.getBits(msheader, 15, 8);
 
-        input.readInt(); // Read total size
+        if (version <= MessagingService.VERSION_11)
+            input.readInt(); // Read total size
         String id = input.readUTF();
         MessageIn message = MessageIn.read(input, version, id);
         assert message.verb == MessagingService.Verb.STREAM_REPLY : "Non-reply message received on stream socket";

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/src/java/org/apache/cassandra/utils/MerkleTree.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/MerkleTree.java b/src/java/org/apache/cassandra/utils/MerkleTree.java
index 2cbecb8..d012912 100644
--- a/src/java/org/apache/cassandra/utils/MerkleTree.java
+++ b/src/java/org/apache/cassandra/utils/MerkleTree.java
@@ -828,7 +828,7 @@ public class MerkleTree implements Serializable
     /**
      * Abstract class containing hashing logic, and containing a single hash field.
      */
-    static abstract class Hashable
+    static abstract class Hashable implements Serializable
     {
         private static final long serialVersionUID = 1L;
         private static final IVersionedSerializer<Hashable> serializer = new HashableSerializer();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/db.RangeSliceCommand.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/db.RangeSliceCommand.bin b/test/data/serialization/1.2/db.RangeSliceCommand.bin
new file mode 100644
index 0000000..1057660
Binary files /dev/null and b/test/data/serialization/1.2/db.RangeSliceCommand.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/db.Row.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/db.Row.bin b/test/data/serialization/1.2/db.Row.bin
new file mode 100644
index 0000000..29fa8da
Binary files /dev/null and b/test/data/serialization/1.2/db.Row.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/db.RowMutation.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/db.RowMutation.bin b/test/data/serialization/1.2/db.RowMutation.bin
new file mode 100644
index 0000000..aa4860d
Binary files /dev/null and b/test/data/serialization/1.2/db.RowMutation.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/db.SliceByNamesReadCommand.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/db.SliceByNamesReadCommand.bin b/test/data/serialization/1.2/db.SliceByNamesReadCommand.bin
new file mode 100644
index 0000000..aa892d5
Binary files /dev/null and b/test/data/serialization/1.2/db.SliceByNamesReadCommand.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/db.SliceFromReadCommand.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/db.SliceFromReadCommand.bin b/test/data/serialization/1.2/db.SliceFromReadCommand.bin
new file mode 100644
index 0000000..7160d24
Binary files /dev/null and b/test/data/serialization/1.2/db.SliceFromReadCommand.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/db.Truncation.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/db.Truncation.bin b/test/data/serialization/1.2/db.Truncation.bin
new file mode 100644
index 0000000..ea67995
Binary files /dev/null and b/test/data/serialization/1.2/db.Truncation.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/db.WriteResponse.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/db.WriteResponse.bin b/test/data/serialization/1.2/db.WriteResponse.bin
new file mode 100644
index 0000000..9076238
Binary files /dev/null and b/test/data/serialization/1.2/db.WriteResponse.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/gms.EndpointState.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/gms.EndpointState.bin b/test/data/serialization/1.2/gms.EndpointState.bin
new file mode 100644
index 0000000..39d608b
Binary files /dev/null and b/test/data/serialization/1.2/gms.EndpointState.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/gms.Gossip.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/gms.Gossip.bin b/test/data/serialization/1.2/gms.Gossip.bin
new file mode 100644
index 0000000..68b0c8f
Binary files /dev/null and b/test/data/serialization/1.2/gms.Gossip.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/service.TreeRequest.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/service.TreeRequest.bin b/test/data/serialization/1.2/service.TreeRequest.bin
new file mode 100644
index 0000000..b12a1b8
Binary files /dev/null and b/test/data/serialization/1.2/service.TreeRequest.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/service.TreeResponse.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/service.TreeResponse.bin b/test/data/serialization/1.2/service.TreeResponse.bin
new file mode 100644
index 0000000..b823033
Binary files /dev/null and b/test/data/serialization/1.2/service.TreeResponse.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/streaming.PendingFile.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/streaming.PendingFile.bin b/test/data/serialization/1.2/streaming.PendingFile.bin
new file mode 100644
index 0000000..5dda246
Binary files /dev/null and b/test/data/serialization/1.2/streaming.PendingFile.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/streaming.StreamHeader.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/streaming.StreamHeader.bin b/test/data/serialization/1.2/streaming.StreamHeader.bin
new file mode 100644
index 0000000..d7fa6d1
Binary files /dev/null and b/test/data/serialization/1.2/streaming.StreamHeader.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/streaming.StreamReply.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/streaming.StreamReply.bin b/test/data/serialization/1.2/streaming.StreamReply.bin
new file mode 100644
index 0000000..4b74058
Binary files /dev/null and b/test/data/serialization/1.2/streaming.StreamReply.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/streaming.StreamRequestMessage.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/streaming.StreamRequestMessage.bin b/test/data/serialization/1.2/streaming.StreamRequestMessage.bin
new file mode 100644
index 0000000..e586cdd
Binary files /dev/null and b/test/data/serialization/1.2/streaming.StreamRequestMessage.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/utils.BloomFilter.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/utils.BloomFilter.bin b/test/data/serialization/1.2/utils.BloomFilter.bin
new file mode 100644
index 0000000..c4e3701
Binary files /dev/null and b/test/data/serialization/1.2/utils.BloomFilter.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/utils.EstimatedHistogram.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/utils.EstimatedHistogram.bin b/test/data/serialization/1.2/utils.EstimatedHistogram.bin
new file mode 100644
index 0000000..bedd39b
Binary files /dev/null and b/test/data/serialization/1.2/utils.EstimatedHistogram.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/data/serialization/1.2/utils.LegacyBloomFilter.bin
----------------------------------------------------------------------
diff --git a/test/data/serialization/1.2/utils.LegacyBloomFilter.bin b/test/data/serialization/1.2/utils.LegacyBloomFilter.bin
new file mode 100644
index 0000000..faef1b8
Binary files /dev/null and b/test/data/serialization/1.2/utils.LegacyBloomFilter.bin differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/AbstractSerializationsTester.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/AbstractSerializationsTester.java b/test/unit/org/apache/cassandra/AbstractSerializationsTester.java
index cf2c079..aafe98b 100644
--- a/test/unit/org/apache/cassandra/AbstractSerializationsTester.java
+++ b/test/unit/org/apache/cassandra/AbstractSerializationsTester.java
@@ -1,6 +1,4 @@
-package org.apache.cassandra;
 /*
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,7 +17,12 @@ package org.apache.cassandra;
  * under the License.
  *
  */
+package org.apache.cassandra;
 
+import com.google.common.io.ByteArrayDataOutput;
+import com.google.common.io.ByteStreams;
+import org.apache.cassandra.io.IVersionedSerializer;
+import org.apache.cassandra.net.MessagingService;
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
@@ -32,11 +35,12 @@ import java.util.Map;
 
 public class AbstractSerializationsTester extends SchemaLoader
 {
-    protected static final String CUR_VER = System.getProperty("cassandra.version", "1.0");
+    protected static final String CUR_VER = System.getProperty("cassandra.version", "1.2");
     protected static final Map<String, Integer> VERSION_MAP = new HashMap<String, Integer> ()
     {{
-            put("0.7", 1);
-            put("1.0", 3);
+        put("0.7", 1);
+        put("1.0", 3);
+        put("1.2", MessagingService.VERSION_12);
     }};
 
     // TODO ant doesn't pass this -D up to the test, so it's kind of useless
@@ -47,6 +51,13 @@ public class AbstractSerializationsTester extends SchemaLoader
         return VERSION_MAP.get(CUR_VER);
     }
 
+    protected <T> void testSerializedSize(T obj, IVersionedSerializer<T> serializer) throws IOException
+    {
+        ByteArrayDataOutput out = ByteStreams.newDataOutput();
+        serializer.serialize(obj, out, getVersion());
+        assert out.toByteArray().length == serializer.serializedSize(obj, getVersion());
+    }
+
     protected static DataInputStream getInput(String name) throws IOException
     {
         File f = new File("test/data/serialization/" + CUR_VER + "/" + name);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/db/SerializationsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SerializationsTest.java b/test/unit/org/apache/cassandra/db/SerializationsTest.java
index b03bc25..967f49e 100644
--- a/test/unit/org/apache/cassandra/db/SerializationsTest.java
+++ b/test/unit/org/apache/cassandra/db/SerializationsTest.java
@@ -1,6 +1,4 @@
-package org.apache.cassandra.db;
 /*
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,9 +15,8 @@ package org.apache.cassandra.db;
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
  */
-
+package org.apache.cassandra.db;
 
 import org.apache.cassandra.AbstractSerializationsTester;
 import org.apache.cassandra.Util;
@@ -37,6 +34,7 @@ import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.SlicePredicate;
 import org.apache.cassandra.thrift.SliceRange;
 import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
 
 import org.junit.Test;
 
@@ -67,21 +65,35 @@ public class SerializationsTest extends AbstractSerializationsTester
         IPartitioner part = StorageService.getPartitioner();
         AbstractBounds<RowPosition> bounds = new Range<Token>(part.getRandomToken(), part.getRandomToken()).toRowBounds();
 
-        MessageOut<RangeSliceCommand> namesCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, namesPred, bounds, 100).createMessage();
-        MessageOut<RangeSliceCommand> emptyRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, emptyRangePred, bounds, 100).createMessage();
-        MessageOut<RangeSliceCommand> regRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null,  nonEmptyRangePred, bounds, 100).createMessage();
-        MessageOut<RangeSliceCommand> namesCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, namesPred, bounds, 100).createMessage();
-        MessageOut<RangeSliceCommand> emptyRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, emptyRangePred, bounds, 100).createMessage();
-        MessageOut<RangeSliceCommand> regRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC,  nonEmptyRangePred, bounds, 100).createMessage();
+        RangeSliceCommand namesCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, namesPred, bounds, 100);
+        MessageOut<RangeSliceCommand> namesCmdMsg = namesCmd.createMessage();
+        RangeSliceCommand emptyRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null, emptyRangePred, bounds, 100);
+        MessageOut<RangeSliceCommand> emptyRangeCmdMsg = emptyRangeCmd.createMessage();
+        RangeSliceCommand regRangeCmd = new RangeSliceCommand(Statics.KS, "Standard1", null,  nonEmptyRangePred, bounds, 100);
+        MessageOut<RangeSliceCommand> regRangeCmdMsg = regRangeCmd.createMessage();
+        RangeSliceCommand namesCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, namesPred, bounds, 100);
+        MessageOut<RangeSliceCommand> namesCmdSupMsg = namesCmdSup.createMessage();
+        RangeSliceCommand emptyRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC, emptyRangePred, bounds, 100);
+        MessageOut<RangeSliceCommand> emptyRangeCmdSupMsg = emptyRangeCmdSup.createMessage();
+        RangeSliceCommand regRangeCmdSup = new RangeSliceCommand(Statics.KS, "Super1", Statics.SC,  nonEmptyRangePred, bounds, 100);
+        MessageOut<RangeSliceCommand> regRangeCmdSupMsg = regRangeCmdSup.createMessage();
         
         DataOutputStream out = getOutput("db.RangeSliceCommand.bin");
-        namesCmd.serialize(out, getVersion());
-        emptyRangeCmd.serialize(out, getVersion());
-        regRangeCmd.serialize(out, getVersion());
-        namesCmdSup.serialize(out, getVersion());
-        emptyRangeCmdSup.serialize(out, getVersion());
-        regRangeCmdSup.serialize(out, getVersion());
+        namesCmdMsg.serialize(out, getVersion());
+        emptyRangeCmdMsg.serialize(out, getVersion());
+        regRangeCmdMsg.serialize(out, getVersion());
+        namesCmdSupMsg.serialize(out, getVersion());
+        emptyRangeCmdSupMsg.serialize(out, getVersion());
+        regRangeCmdSupMsg.serialize(out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(namesCmd, RangeSliceCommand.serializer);
+        testSerializedSize(emptyRangeCmd, RangeSliceCommand.serializer);
+        testSerializedSize(regRangeCmd, RangeSliceCommand.serializer);
+        testSerializedSize(namesCmdSup, RangeSliceCommand.serializer);
+        testSerializedSize(emptyRangeCmdSup, RangeSliceCommand.serializer);
+        testSerializedSize(regRangeCmdSup, RangeSliceCommand.serializer);
     }
 
     @Test
@@ -109,6 +121,10 @@ public class SerializationsTest extends AbstractSerializationsTester
         standardCmd.createMessage().serialize(out, getVersion());
         superCmd.createMessage().serialize(out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(standardCmd, SliceByNamesReadCommand.serializer());
+        testSerializedSize(superCmd, SliceByNamesReadCommand.serializer());
     }
 
     @Test
@@ -139,6 +155,10 @@ public class SerializationsTest extends AbstractSerializationsTester
         standardCmd.createMessage().serialize(out, getVersion());
         superCmd.createMessage().serialize(out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(standardCmd, SliceFromReadCommand.serializer());
+        testSerializedSize(superCmd, SliceFromReadCommand.serializer());
     }
 
     @Test
@@ -164,6 +184,11 @@ public class SerializationsTest extends AbstractSerializationsTester
         Row.serializer().serialize(Statics.SuperRow, out, getVersion());
         Row.serializer().serialize(Statics.NullRow, out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(Statics.StandardRow, Row.serializer());
+        testSerializedSize(Statics.SuperRow, Row.serializer());
+        testSerializedSize(Statics.NullRow, Row.serializer());
     }
 
     @Test
@@ -179,7 +204,7 @@ public class SerializationsTest extends AbstractSerializationsTester
         in.close();
     }
 
-    private void restRowMutationWrite() throws IOException
+    private void testRowMutationWrite() throws IOException
     {
         RowMutation emptyRm = new RowMutation(Statics.KS, Statics.Key);
         RowMutation standardRowRm = new RowMutation(Statics.KS, Statics.StandardRow);
@@ -209,13 +234,21 @@ public class SerializationsTest extends AbstractSerializationsTester
         mixedRm.createMessage().serialize(out, getVersion());
 
         out.close();
+
+        // test serializedSize
+        testSerializedSize(emptyRm, RowMutation.serializer());
+        testSerializedSize(standardRowRm, RowMutation.serializer());
+        testSerializedSize(superRowRm, RowMutation.serializer());
+        testSerializedSize(standardRm, RowMutation.serializer());
+        testSerializedSize(superRm, RowMutation.serializer());
+        testSerializedSize(mixedRm, RowMutation.serializer());
     }
 
     @Test
     public void testRowMutationRead() throws IOException
     {
         if (EXECUTE_WRITES)
-            restRowMutationWrite();
+            testRowMutationWrite();
 
         DataInputStream in = getInput("db.RowMutation.bin");
         assert RowMutation.serializer().deserialize(in, getVersion()) != null;
@@ -233,7 +266,7 @@ public class SerializationsTest extends AbstractSerializationsTester
         in.close();
     }
 
-    public void testTruncateWrite() throws IOException
+    private void testTruncateWrite() throws IOException
     {
         Truncation tr = new Truncation(Statics.KS, "Doesn't Really Matter");
         TruncateResponse aff = new TruncateResponse(Statics.KS, "Doesn't Matter Either", true);
@@ -248,6 +281,11 @@ public class SerializationsTest extends AbstractSerializationsTester
         neg.createMessage().serialize(out, getVersion());
         // todo: notice how CF names weren't validated.
         out.close();
+
+        // test serializedSize
+        testSerializedSize(tr, Truncation.serializer());
+        testSerializedSize(aff, TruncateResponse.serializer());
+        testSerializedSize(neg, TruncateResponse.serializer());
     }
 
     @Test
@@ -279,6 +317,10 @@ public class SerializationsTest extends AbstractSerializationsTester
         WriteResponse.serializer().serialize(aff, out, getVersion());
         WriteResponse.serializer().serialize(neg, out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(aff, WriteResponse.serializer());
+        testSerializedSize(neg, WriteResponse.serializer());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/gms/SerializationsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/gms/SerializationsTest.java b/test/unit/org/apache/cassandra/gms/SerializationsTest.java
index 7fd6aac..a86e11c 100644
--- a/test/unit/org/apache/cassandra/gms/SerializationsTest.java
+++ b/test/unit/org/apache/cassandra/gms/SerializationsTest.java
@@ -1,6 +1,4 @@
-package org.apache.cassandra.gms;
 /*
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,9 +15,8 @@ package org.apache.cassandra.gms;
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
  */
-
+package org.apache.cassandra.gms;
 
 import org.apache.cassandra.AbstractSerializationsTester;
 import org.apache.cassandra.service.StorageService;
@@ -46,6 +43,12 @@ public class SerializationsTest extends AbstractSerializationsTester
         VersionedValue.serializer.serialize(Statics.vv0, out, getVersion());
         VersionedValue.serializer.serialize(Statics.vv1, out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(Statics.HeartbeatSt, HeartBeatState.serializer());
+        testSerializedSize(Statics.EndpointSt, EndpointState.serializer());
+        testSerializedSize(Statics.vv0, VersionedValue.serializer);
+        testSerializedSize(Statics.vv1, VersionedValue.serializer);
     }
 
     @Test
@@ -78,6 +81,13 @@ public class SerializationsTest extends AbstractSerializationsTester
         GossipDigestAck2.serializer().serialize(ack2, out, getVersion());
         GossipDigestSyn.serializer().serialize(syn, out, getVersion());
         out.close();
+
+        // test serializedSize
+        for (GossipDigest gd : Statics.Digests)
+            testSerializedSize(gd, GossipDigest.serializer());
+        testSerializedSize(ack, GossipDigestAck.serializer());
+        testSerializedSize(ack2, GossipDigestAck2.serializer());
+        testSerializedSize(syn, GossipDigestSyn.serializer());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/io/CompactSerializerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java
index 4fbab95..9ba3948 100644
--- a/test/unit/org/apache/cassandra/io/CompactSerializerTest.java
+++ b/test/unit/org/apache/cassandra/io/CompactSerializerTest.java
@@ -55,23 +55,31 @@ public class CompactSerializerTest extends SchemaLoader
         expectedClassNames.add("WriteResponseSerializer");
         expectedClassNames.add("EndpointStateSerializer");
         expectedClassNames.add("GossipDigestSerializer");
-        expectedClassNames.add("GossipDigestAck2MessageSerializer");
-        expectedClassNames.add("GossipDigestAckMessageSerializer");
-        expectedClassNames.add("GossipDigestSynMessageSerializer");
-        expectedClassNames.add("GossipShutdownMessageSerializer");
+        expectedClassNames.add("GossipDigestAck2Serializer");
+        expectedClassNames.add("GossipDigestAckSerializer");
+        expectedClassNames.add("GossipDigestSynSerializer");
         expectedClassNames.add("HeartBeatStateSerializer");
         expectedClassNames.add("VersionedValueSerializer");
-        expectedClassNames.add("HeaderSerializer");
-        expectedClassNames.add("MessageSerializer");
         expectedClassNames.add("PendingFileSerializer");
         expectedClassNames.add("StreamHeaderSerializer");
         expectedClassNames.add("FileStatusSerializer");
-        expectedClassNames.add("StreamRequestMessageSerializer");
+        expectedClassNames.add("StreamRequestSerializer");
         expectedClassNames.add("CounterMutationSerializer");
         expectedClassNames.add("HashableSerializer");
         expectedClassNames.add("StreamingRepairTaskSerializer");
         expectedClassNames.add("AbstractBoundsSerializer");
         expectedClassNames.add("SnapshotCommandSerializer");
+        expectedClassNames.add("RangeSliceReplySerializer");
+        expectedClassNames.add("StringSerializer");
+        expectedClassNames.add("GossipShutdownMessageSerializer");
+        expectedClassNames.add("CallbackDeterminedSerializer");
+        expectedClassNames.add("TreeRequestSerializer");
+        expectedClassNames.add("ValidatorSerializer");
+        expectedClassNames.add("MigrationsSerializer");
+        expectedClassNames.add("InnerSerializer");
+        expectedClassNames.add("LeafSerializer");
+        expectedClassNames.add("MerkleTreeSerializer");
+        expectedClassNames.add("UUIDSerializer");
 
         discoveredClassNames = new ArrayList<String>();
         String cp = System.getProperty("java.class.path");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/service/RemoveTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/RemoveTest.java b/test/unit/org/apache/cassandra/service/RemoveTest.java
index 0ae9c38..cfbc013 100644
--- a/test/unit/org/apache/cassandra/service/RemoveTest.java
+++ b/test/unit/org/apache/cassandra/service/RemoveTest.java
@@ -22,6 +22,7 @@ package org.apache.cassandra.service;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -153,8 +154,7 @@ public class RemoveTest
 
         for (InetAddress host : hosts)
         {
-            // TODO how to spoof host here?
-            MessageOut msg = new MessageOut(MessagingService.Verb.REPLICATION_FINISHED);
+            MessageOut msg = new MessageOut(host, MessagingService.Verb.REPLICATION_FINISHED, null, null, Collections.<String, byte[]>emptyMap());
             MessagingService.instance().sendRR(msg, FBUtilities.getBroadcastAddress());
         }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/service/SerializationsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/SerializationsTest.java b/test/unit/org/apache/cassandra/service/SerializationsTest.java
index 43752bf..bec14c2 100644
--- a/test/unit/org/apache/cassandra/service/SerializationsTest.java
+++ b/test/unit/org/apache/cassandra/service/SerializationsTest.java
@@ -1,6 +1,4 @@
-package org.apache.cassandra.service;
 /*
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,13 +15,14 @@ package org.apache.cassandra.service;
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
  */
-
+package org.apache.cassandra.service;
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.junit.Test;
 
@@ -51,6 +50,9 @@ public class SerializationsTest extends AbstractSerializationsTester
         AntiEntropyService.TreeRequest.serializer.serialize(Statics.req, out, getVersion());
         Statics.req.createMessage().serialize(out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(Statics.req, AntiEntropyService.TreeRequest.serializer);
     }
 
     @Test
@@ -83,6 +85,10 @@ public class SerializationsTest extends AbstractSerializationsTester
         v0.createMessage().serialize(out, getVersion());
         v1.createMessage().serialize(out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(v0, AntiEntropyService.Validator.serializer);
+        testSerializedSize(v1, AntiEntropyService.Validator.serializer);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
index 2f9f8d9..94fb3bd 100644
--- a/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
+++ b/test/unit/org/apache/cassandra/streaming/SerializationsTest.java
@@ -1,6 +1,4 @@
-package org.apache.cassandra.streaming;
 /*
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,9 +15,8 @@ package org.apache.cassandra.streaming;
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
  */
-
+package org.apache.cassandra.streaming;
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
@@ -63,6 +60,12 @@ public class SerializationsTest extends AbstractSerializationsTester
         PendingFile.serializer().serialize(noSST, out, getVersion());
         PendingFile.serializer().serialize(null, out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(normal, PendingFile.serializer());
+        testSerializedSize(noSections, PendingFile.serializer());
+        testSerializedSize(noSST, PendingFile.serializer());
+        testSerializedSize(null, PendingFile.serializer());
     }
 
     @Test
@@ -97,6 +100,13 @@ public class SerializationsTest extends AbstractSerializationsTester
         StreamHeader.serializer().serialize(sh3, out, getVersion());
         StreamHeader.serializer().serialize(sh4, out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(sh0, StreamHeader.serializer());
+        testSerializedSize(sh1, StreamHeader.serializer());
+        testSerializedSize(sh2, StreamHeader.serializer());
+        testSerializedSize(sh3, StreamHeader.serializer());
+        testSerializedSize(sh4, StreamHeader.serializer());
     }
 
     @Test
@@ -121,6 +131,9 @@ public class SerializationsTest extends AbstractSerializationsTester
         StreamReply.serializer.serialize(rep, out, getVersion());
         rep.createMessage().serialize(out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(rep, StreamReply.serializer);
     }
 
     @Test
@@ -162,6 +175,11 @@ public class SerializationsTest extends AbstractSerializationsTester
         msg1.createMessage().serialize(out, getVersion());
         msg2.createMessage().serialize(out, getVersion());
         out.close();
+
+        // test serializedSize
+        testSerializedSize(msg0, StreamRequest.serializer());
+        testSerializedSize(msg1, StreamRequest.serializer());
+        testSerializedSize(msg2, StreamRequest.serializer());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f81cc74f/test/unit/org/apache/cassandra/utils/SerializationsTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/utils/SerializationsTest.java b/test/unit/org/apache/cassandra/utils/SerializationsTest.java
index 34733e3..08053df 100644
--- a/test/unit/org/apache/cassandra/utils/SerializationsTest.java
+++ b/test/unit/org/apache/cassandra/utils/SerializationsTest.java
@@ -1,6 +1,4 @@
-package org.apache.cassandra.utils;
 /*
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,9 +15,8 @@ package org.apache.cassandra.utils;
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
- *
  */
-
+package org.apache.cassandra.utils;
 
 import org.apache.cassandra.AbstractSerializationsTester;
 import org.apache.cassandra.service.StorageService;
@@ -36,7 +33,7 @@ public class SerializationsTest extends AbstractSerializationsTester
 
     private void testBloomFilterWrite(Type murmur) throws IOException
     {
-        Filter bf = FilterFactory.getFilter(1000000, 0.0001);
+        Filter bf = FilterFactory.getFilter(1000000, 0.0001, murmur);
         for (int i = 0; i < 100; i++)
             bf.add(StorageService.getPartitioner().getTokenFactory().toByteArray(StorageService.getPartitioner().getRandomToken()));
         DataOutputStream out = getOutput("utils.BloomFilter.bin");


Mime
View raw message