cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1127130 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/db/ColumnFamily.java src/java/org/apache/cassandra/db/filter/QueryFilter.java
Date Tue, 24 May 2011 16:23:27 GMT
Author: slebresne
Date: Tue May 24 16:23:27 2011
New Revision: 1127130

URL: http://svn.apache.org/viewvc?rev=1127130&view=rev
Log:
Clone super column to avoid modifying them mid-flush
patch by slebresne; reviewed by jbellis for CASSANDRA-2675

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamily.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/filter/QueryFilter.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1127130&r1=1127129&r2=1127130&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Tue May 24 16:23:27 2011
@@ -8,6 +8,7 @@
  * avoid replaying hints to dropped columnfamilies (CASSANDRA-2685)
  * add placeholders for missing rows in range query pseudo-RR (CASSANDRA-2680)
  * remove no-op HHOM.renameHints (CASSANDRA-2693)
+ * clone super columns to avoid modifying them during flush (CASSANDRA-2675)
 
 
 0.7.6

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamily.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamily.java?rev=1127130&r1=1127129&r2=1127130&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamily.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamily.java Tue
May 24 16:23:27 2011
@@ -146,6 +146,11 @@ public class ColumnFamily implements ICo
         return columns.size();
     }
 
+    public boolean isEmpty()
+    {
+        return columns.isEmpty();
+    }
+
     public boolean isSuper()
     {
         return type == ColumnFamilyType.Super;

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/filter/QueryFilter.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/filter/QueryFilter.java?rev=1127130&r1=1127129&r2=1127130&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/filter/QueryFilter.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/filter/QueryFilter.java
Tue May 24 16:23:27 2011
@@ -103,7 +103,19 @@ public class QueryFilter
 
             public void reduce(IColumn current)
             {
-                curCF.addColumn(current);
+                if (curCF.isSuper() && curCF.isEmpty())
+                {
+                    // If it is the first super column we add, we must clone it since other
super column may modify
+                    // it otherwise and it could be aliased in a memtable somewhere. We'll
also don't have to care about what
+                    // consumers make of the result (for instance CFS.getColumnFamily() call
removeDeleted() on the
+                    // result which removes column; which shouldn't be done on the original
super column).
+                    assert current instanceof SuperColumn;
+                    curCF.addColumn(((SuperColumn)current).cloneMe());
+                }
+                else
+                {
+                    curCF.addColumn(current);
+                }
             }
 
             protected IColumn getReduced()



Mime
View raw message