cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r926610 - in /cassandra/branches/cassandra-0.6: CHANGES.txt src/java/org/apache/cassandra/db/RowMutation.java test/system/test_server.py
Date Tue, 23 Mar 2010 15:10:02 GMT
Author: jbellis
Date: Tue Mar 23 15:10:02 2010
New Revision: 926610

URL: http://svn.apache.org/viewvc?rev=926610&view=rev
Log:
Treat batch_mutate Deletion with null supercolumn as "apply this predicate to top level supercolumns".
patch by jbellis; reviewed by Brandon Williams for CASSANDRA-834

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/RowMutation.java
    cassandra/branches/cassandra-0.6/test/system/test_server.py

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=926610&r1=926609&r2=926610&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Tue Mar 23 15:10:02 2010
@@ -9,6 +9,8 @@
  * bound read, mutation, and response stages to fix possible OOM
    during log replay (CASSANDRA-885)
  * Use microseconds-since-epoch (UTC) in cli, instead of milliseconds
+ * Treat batch_mutate Deletion with null supercolumn as "apply this predicate 
+   to top level supercolumns" (CASSANDRA-834)
 
 
 0.6.0-beta3

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/RowMutation.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/RowMutation.java?rev=926610&r1=926609&r2=926610&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/RowMutation.java (original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/RowMutation.java Tue
Mar 23 15:10:02 2010
@@ -306,12 +306,15 @@ public class RowMutation
         {
             for(byte[] c : del.predicate.column_names)
             {
-                rm.delete(new QueryPath(cfName, del.super_column, c), del.timestamp);
+                if (del.super_column == null && DatabaseDescriptor.getColumnFamilyType(rm.table_,
cfName).equals("Super"))
+                    rm.delete(new QueryPath(cfName, c), del.timestamp);
+                else
+                    rm.delete(new QueryPath(cfName, del.super_column, c), del.timestamp);
             }
         }
         else
         {
-            rm.delete(new QueryPath(cfName, del.super_column, null), del.timestamp);
+            rm.delete(new QueryPath(cfName, del.super_column), del.timestamp);
         }
     }
 }

Modified: cassandra/branches/cassandra-0.6/test/system/test_server.py
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/test/system/test_server.py?rev=926610&r1=926609&r2=926610&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/test/system/test_server.py (original)
+++ cassandra/branches/cassandra-0.6/test/system/test_server.py Tue Mar 23 15:10:02 2010
@@ -330,14 +330,12 @@ class TestMutations(CassandraTester):
                 _assert_column('Keyspace1', column_family, key, 'c1', 'value1')
 
     def test_batch_mutate_remove_standard_columns(self):
-
         column_families = ['Standard1', 'Standard2']
         keys = ['key_%d' % i for i in range(11,21)]
         _insert_multi(keys)
 
         mutations = [Mutation(deletion=Deletion(20, predicate=SlicePredicate(column_names=[c.name])))
for c in _SIMPLE_COLUMNS]
         mutation_map = dict((column_family, mutations) for column_family in column_families)
-
         keyed_mutations = dict((key, mutation_map) for key in keys)
 
         client.batch_mutate('Keyspace1', keyed_mutations, ConsistencyLevel.ONE)
@@ -888,6 +886,14 @@ class TestMutations(CassandraTester):
             assert rows.has_key(key) == True
             assert columns == rows[key]
 
+    def test_batch_mutate_super_deletion(self):
+        _insert_super('test')
+        d = Deletion(1, predicate=SlicePredicate(column_names=['sc1']))
+        cfmap = {'Super1': [Mutation(deletion=d)]}
+        mutation_map = {'test': cfmap}
+        client.batch_mutate('Keyspace1', mutation_map, ConsistencyLevel.ONE)
+        _expect_missing(lambda: client.get('Keyspace1', 'key1', ColumnPath('Super1', 'sc1'),
ConsistencyLevel.ONE))
+
     def test_describe_keyspace(self):
         """ Test keyspace description """
         kspaces = client.describe_keyspaces()



Mime
View raw message