You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2011/06/30 02:59:13 UTC

svn commit: r1141353 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/db/Table.java

Author: jbellis
Date: Thu Jun 30 00:59:12 2011
New Revision: 1141353

URL: http://svn.apache.org/viewvc?rev=1141353&view=rev
Log:
allow deleting and inserting into an indexed row in the same mutation
patch by jbellis; reviewed by slebresne and tested by Jim Ancona for CASSANDRA-2773

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Table.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1141353&r1=1141352&r2=1141353&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Thu Jun 30 00:59:12 2011
@@ -29,6 +29,8 @@
  * fix scan wrongly throwing assertion error (CASSANDRA-2653)
  * Always use even distribution for merkle tree with RandomPartitionner
    (CASSANDRA-2841)
+ * allow deleting a row and updating indexed columns in it in the
+   same mutation (CASSANDRA-2773)
 
 
 0.7.6

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Table.java?rev=1141353&r1=1141352&r2=1141353&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Table.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/Table.java Thu Jun 30 00:59:12 2011
@@ -429,7 +429,16 @@ public class Table
             ByteBuffer name = iter.next();
             IColumn newColumn = cf.getColumn(name); // null == row delete or it wouldn't be marked Mutated
             if (newColumn != null && cf.isMarkedForDelete())
-                throw new UnsupportedOperationException("Index manager cannot support deleting and inserting into a row in the same mutation");
+            {
+                // row is marked for delete, but column was also updated.  if column is timestamped less than
+                // the row tombstone, treat it as if it didn't exist.  Otherwise we don't care about row
+                // tombstone for the purpose of the index update and we can proceed as usual.
+                if (newColumn.timestamp() <= cf.getMarkedForDeleteAt())
+                {
+                    // don't remove from the cf object; that can race w/ CommitLog write.  Leaving it is harmless.
+                    newColumn = null;
+                }
+            }
             IColumn oldColumn = oldIndexedColumns.getColumn(name);
 
             // deletions are irrelevant to the index unless we're changing state from live -> deleted, i.e.,