cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [3/3] git commit: Thrift cas() method crashes if input columns are not sorted
Date Mon, 22 Jul 2013 13:47:45 GMT
Thrift cas() method crashes if input columns are not sorted

patch by slebresne; reviewed by jbellis for CASSANDRA-5786


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

Branch: refs/heads/trunk
Commit: b7a016d992254701c5ad8d8d0ec038df4eda5026
Parents: 37130b5
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon Jul 22 15:46:25 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Jul 22 15:46:25 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                                    | 1 +
 src/java/org/apache/cassandra/db/ColumnFamily.java             | 3 ++-
 src/java/org/apache/cassandra/service/paxos/Commit.java        | 4 +++-
 .../org/apache/cassandra/service/paxos/PrepareResponse.java    | 6 ++++--
 4 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7a016d9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 20a6373..dec32d7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -15,6 +15,7 @@
  * Always respect protocol version in native protocol (CASSANDRA-5778)
  * Fix ConcurrentModificationException during streaming (CASSANDRA-5782)
  * Update deletion timestamp in Commit#updatesWithPaxosTime (CASSANDRA-5787)
+ * Thrift cas() method crashes if input columns are not sorted (CASSANDRA-5786)
 
 
 2.0.0-beta1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7a016d9/src/java/org/apache/cassandra/db/ColumnFamily.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamily.java b/src/java/org/apache/cassandra/db/ColumnFamily.java
index 5715058..3bbf533 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamily.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamily.java
@@ -471,6 +471,7 @@ public abstract class ColumnFamily implements Iterable<Column>,
IRowCacheEntry
         return builder.build();
     }
 
+    // Note: the returned ColumnFamily will be an UnsortedColumns.
     public static ColumnFamily fromBytes(ByteBuffer bytes)
     {
         if (bytes == null)
@@ -478,7 +479,7 @@ public abstract class ColumnFamily implements Iterable<Column>,
IRowCacheEntry
 
         try
         {
-            return serializer.deserialize(new DataInputStream(ByteBufferUtil.inputStream(bytes)),
MessagingService.current_version);
+            return serializer.deserialize(new DataInputStream(ByteBufferUtil.inputStream(bytes)),
UnsortedColumns.factory, ColumnSerializer.Flag.LOCAL, MessagingService.current_version);
         }
         catch (IOException e)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7a016d9/src/java/org/apache/cassandra/service/paxos/Commit.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/paxos/Commit.java b/src/java/org/apache/cassandra/service/paxos/Commit.java
index 04ddca8..84589cc 100644
--- a/src/java/org/apache/cassandra/service/paxos/Commit.java
+++ b/src/java/org/apache/cassandra/service/paxos/Commit.java
@@ -32,8 +32,10 @@ import com.google.common.base.Objects;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.Column;
 import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.ColumnSerializer;
 import org.apache.cassandra.db.EmptyColumns;
 import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.UnsortedColumns;
 import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.UUIDGen;
@@ -139,7 +141,7 @@ public class Commit
         {
             return new Commit(ByteBufferUtil.readWithShortLength(in),
                               UUIDSerializer.serializer.deserialize(in, version),
-                              ColumnFamily.serializer.deserialize(in, version));
+                              ColumnFamily.serializer.deserialize(in, UnsortedColumns.factory,
ColumnSerializer.Flag.LOCAL, version));
         }
 
         public long serializedSize(Commit commit, int version)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b7a016d9/src/java/org/apache/cassandra/service/paxos/PrepareResponse.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/paxos/PrepareResponse.java b/src/java/org/apache/cassandra/service/paxos/PrepareResponse.java
index 246e09a..9f5fda6 100644
--- a/src/java/org/apache/cassandra/service/paxos/PrepareResponse.java
+++ b/src/java/org/apache/cassandra/service/paxos/PrepareResponse.java
@@ -27,6 +27,8 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 
 import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.ColumnSerializer;
+import org.apache.cassandra.db.UnsortedColumns;
 import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.UUIDSerializer;
@@ -74,10 +76,10 @@ public class PrepareResponse
             return new PrepareResponse(success,
                                        new Commit(key,
                                                   UUIDSerializer.serializer.deserialize(in,
version),
-                                                  ColumnFamily.serializer.deserialize(in,
version)),
+                                                  ColumnFamily.serializer.deserialize(in,
UnsortedColumns.factory, ColumnSerializer.Flag.LOCAL, version)),
                                        new Commit(key,
                                                   UUIDSerializer.serializer.deserialize(in,
version),
-                                                  ColumnFamily.serializer.deserialize(in,
version)));
+                                                  ColumnFamily.serializer.deserialize(in,
UnsortedColumns.factory, ColumnSerializer.Flag.LOCAL, version)));
         }
 
         public long serializedSize(PrepareResponse response, int version)


Mime
View raw message