Updated Branches: refs/heads/trunk f04359d91 -> 8ce9edf04
fix SerializationsTest Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8ce9edf0 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8ce9edf0 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8ce9edf0 Branch: refs/heads/trunk Commit: 8ce9edf0409945c81f36c08f0e8e39c1ccb7db4b Parents: f04359d Author: Jonathan Ellis <[email protected]> Authored: Thu Apr 11 21:31:27 2013 -0500 Committer: Jonathan Ellis <[email protected]> Committed: Thu Apr 11 21:31:27 2013 -0500 ---------------------------------------------------------------------- src/java/org/apache/cassandra/db/RowMutation.java | 5 ++++- test/data/serialization/2.0/db.RowMutation.bin | Bin 3770 -> 3599 bytes .../cassandra/AbstractSerializationsTester.java | 1 - .../apache/cassandra/db/SerializationsTest.java | 12 ++++-------- 4 files changed, 8 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ce9edf0/src/java/org/apache/cassandra/db/RowMutation.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/db/RowMutation.java b/src/java/org/apache/cassandra/db/RowMutation.java index ef63027..9e0e78f 100644 --- a/src/java/org/apache/cassandra/db/RowMutation.java +++ b/src/java/org/apache/cassandra/db/RowMutation.java @@ -40,7 +40,10 @@ public class RowMutation implements IMutation public static final String FORWARD_TO = "FWD_TO"; public static final String FORWARD_FROM = "FWD_FRM"; - private final String table; // todo this is redundant + // todo this is redundant + // when we remove it, also restore SerializationsTest.testRowMutationRead to not regenerate new RowMutations each test + private final String table; + private final ByteBuffer key; // map of column family id to mutations for that column family. private final Map<UUID, ColumnFamily> modifications; http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ce9edf0/test/data/serialization/2.0/db.RowMutation.bin ---------------------------------------------------------------------- diff --git a/test/data/serialization/2.0/db.RowMutation.bin b/test/data/serialization/2.0/db.RowMutation.bin index 0f024ac..94bb810 100644 Binary files a/test/data/serialization/2.0/db.RowMutation.bin and b/test/data/serialization/2.0/db.RowMutation.bin differ http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ce9edf0/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 807fd98..22b2424 100644 --- a/test/unit/org/apache/cassandra/AbstractSerializationsTester.java +++ b/test/unit/org/apache/cassandra/AbstractSerializationsTester.java @@ -44,7 +44,6 @@ public class AbstractSerializationsTester extends SchemaLoader put("2.0", MessagingService.VERSION_20); }}; - // TODO ant doesn't pass this -D up to the test, so it's kind of useless protected static final boolean EXECUTE_WRITES = Boolean.getBoolean("cassandra.test-serialization-writes"); protected final int getVersion() http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ce9edf0/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 8c9af0f..f87a0f8 100644 --- a/test/unit/org/apache/cassandra/db/SerializationsTest.java +++ b/test/unit/org/apache/cassandra/db/SerializationsTest.java @@ -210,7 +210,6 @@ public class SerializationsTest extends AbstractSerializationsTester private void testRowMutationWrite() throws IOException { - RowMutation emptyRm = new RowMutation(statics.KS, statics.Key); RowMutation standardRowRm = new RowMutation(statics.KS, statics.StandardRow); RowMutation superRowRm = new RowMutation(statics.KS, statics.SuperRow); RowMutation standardRm = new RowMutation(statics.KS, statics.Key, statics.StandardCf); @@ -221,14 +220,12 @@ public class SerializationsTest extends AbstractSerializationsTester RowMutation mixedRm = new RowMutation(statics.KS, statics.Key, mods); DataOutputStream out = getOutput("db.RowMutation.bin"); - RowMutation.serializer.serialize(emptyRm, out, getVersion()); RowMutation.serializer.serialize(standardRowRm, out, getVersion()); RowMutation.serializer.serialize(superRowRm, out, getVersion()); RowMutation.serializer.serialize(standardRm, out, getVersion()); RowMutation.serializer.serialize(superRm, out, getVersion()); RowMutation.serializer.serialize(mixedRm, out, getVersion()); - emptyRm.createMessage().serialize(out, getVersion()); standardRowRm.createMessage().serialize(out, getVersion()); superRowRm.createMessage().serialize(out, getVersion()); standardRm.createMessage().serialize(out, getVersion()); @@ -238,7 +235,6 @@ public class SerializationsTest extends AbstractSerializationsTester out.close(); // test serializedSize - testSerializedSize(emptyRm, RowMutation.serializer); testSerializedSize(standardRowRm, RowMutation.serializer); testSerializedSize(superRowRm, RowMutation.serializer); testSerializedSize(standardRm, RowMutation.serializer); @@ -249,8 +245,10 @@ public class SerializationsTest extends AbstractSerializationsTester @Test public void testRowMutationRead() throws IOException { - if (EXECUTE_WRITES) - testRowMutationWrite(); + // row mutation deserialization requires being able to look up the table in the schema, + // so we need to rewrite this each time. We can go back to testing on-disk data + // once we pull RM.table field out. + testRowMutationWrite(); DataInputStream in = getInput("db.RowMutation.bin"); assert RowMutation.serializer.deserialize(in, getVersion()) != null; @@ -258,8 +256,6 @@ public class SerializationsTest extends AbstractSerializationsTester assert RowMutation.serializer.deserialize(in, getVersion()) != null; assert RowMutation.serializer.deserialize(in, getVersion()) != null; assert RowMutation.serializer.deserialize(in, getVersion()) != null; - assert RowMutation.serializer.deserialize(in, getVersion()) != null; - assert MessageIn.read(in, getVersion(), -1) != null; assert MessageIn.read(in, getVersion(), -1) != null; assert MessageIn.read(in, getVersion(), -1) != null; assert MessageIn.read(in, getVersion(), -1) != null;
