cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1156221 - in /cassandra/branches/cassandra-0.8: CHANGES.txt src/java/org/apache/cassandra/db/RowMutation.java
Date Wed, 10 Aug 2011 15:18:45 GMT
Author: slebresne
Date: Wed Aug 10 15:18:44 2011
New Revision: 1156221

URL: http://svn.apache.org/viewvc?rev=1156221&view=rev
Log:
Force deserialization of RowMutation for counters
patch by slebresne; reviewed by jbellis for CASSANDRA-3006

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1156221&r1=1156220&r2=1156221&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Wed Aug 10 15:18:44 2011
@@ -5,6 +5,7 @@
  * refuse counter write for CL.ANY (CASSANDRA-2990)
  * switch back to only logging recent dropped messages (CASSANDRA-3004)
  * fix issues with parameters being escaped incorrectly in Python CQL (CASSANDRA-2993)
+ * force to always deseriale RowMutation for counters (CASSANDRA-3006)
 
 0.8.3
  * add ability to drop local reads/writes that are going to timeout

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java?rev=1156221&r1=1156220&r2=1156221&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java (original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/RowMutation.java Wed
Aug 10 15:18:44 2011
@@ -327,7 +327,19 @@ public class RowMutation implements IMut
     static RowMutation fromBytes(byte[] raw, int version) throws IOException
     {
         RowMutation rm = serializer_.deserialize(new DataInputStream(new ByteArrayInputStream(raw)),
version);
-        rm.preserializedBuffers.put(version, raw);
+        boolean hasCounters = false;
+        for (Map.Entry<Integer, ColumnFamily> entry : rm.modifications_.entrySet())
+        {
+            if (entry.getValue().metadata().getDefaultValidator().isCommutative())
+            {
+                hasCounters = true;
+                break;
+            }
+        }
+
+        // We need to deserialize at least once for counters to cleanup the delta
+        if (!hasCounters)
+            rm.preserializedBuffers.put(version, raw);
         return rm;
     }
 



Mime
View raw message