Return-Path: Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: (qmail 47287 invoked from network); 27 Apr 2010 18:46:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Apr 2010 18:46:35 -0000 Received: (qmail 2638 invoked by uid 500); 27 Apr 2010 18:46:35 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 2624 invoked by uid 500); 27 Apr 2010 18:46:35 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 2616 invoked by uid 99); 27 Apr 2010 18:46:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 18:46:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 18:46:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AFF4C23889B6; Tue, 27 Apr 2010 18:45:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r938601 - in /cassandra/trunk: src/java/org/apache/cassandra/thrift/ThriftValidation.java test/system/test_thrift_server.py Date: Tue, 27 Apr 2010 18:45:49 -0000 To: commits@cassandra.apache.org From: jbellis@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100427184549.AFF4C23889B6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jbellis Date: Tue Apr 27 18:45:49 2010 New Revision: 938601 URL: http://svn.apache.org/viewvc?rev=938601&view=rev Log: allow null predicates in Deletions. patch by Sylvain Lebresne; reviewed by jbellis for CASSANDRA-1027 Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java cassandra/trunk/test/system/test_thrift_server.py Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=938601&r1=938600&r2=938601&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java Tue Apr 27 18:45:49 2010 @@ -260,11 +260,6 @@ public class ThriftValidation public static void validateDeletion(String keyspace, String cfName, Deletion del) throws InvalidRequestException { - if (del.super_column == null && del.predicate == null) - { - throw new InvalidRequestException("A Deletion must have a SuperColumn, a SlicePredicate or both."); - } - if (del.predicate != null) { validateSlicePredicate(keyspace, cfName, del.super_column, del.predicate); Modified: cassandra/trunk/test/system/test_thrift_server.py URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_thrift_server.py?rev=938601&r1=938600&r2=938601&view=diff ============================================================================== --- cassandra/trunk/test/system/test_thrift_server.py (original) +++ cassandra/trunk/test/system/test_thrift_server.py Tue Apr 27 18:45:49 2010 @@ -395,6 +395,24 @@ class TestMutations(ThriftTester): for key in keys: _assert_no_columnpath(key, ColumnPath(column_family, column=c.name)) + def test_batch_mutate_remove_standard_row(self): + _empty_login('Keyspace1') + column_families = ['Standard1', 'Standard2'] + keys = ['key_%d' % i for i in range(11,21)] + _insert_multi(keys) + + mutations = [Mutation(deletion=Deletion(20))] + 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(keyed_mutations, ConsistencyLevel.ONE) + + for column_family in column_families: + for c in _SIMPLE_COLUMNS: + for key in keys: + _assert_no_columnpath(key, ColumnPath(column_family, column=c.name)) + def test_batch_mutate_remove_super_columns_with_standard_under(self): _empty_login('Keyspace1') column_families = ['Super1', 'Super2'] @@ -448,6 +466,33 @@ class TestMutations(ThriftTester): for c in sc.columns: for key in keys: waitfor(ZERO_WAIT, _assert_no_columnpath, key, ColumnPath('Super1', super_column=sc.name)) + + def test_batch_mutate_remove_super_columns_entire_row(self): + _empty_login('Keyspace1') + + keys = ['key_%d' % i for i in range(17,21)] + + for key in keys: + _insert_super(key) + + mutations = [] + + mutations.append(Mutation(deletion=Deletion(20))) + + mutation_map = {'Super1': mutations} + + keyed_mutations = dict((key, mutation_map) for key in keys) + + # Sanity check + for sc in _SUPER_COLUMNS: + for key in keys: + _assert_columnpath_exists(key, ColumnPath('Super1', super_column=sc.name)) + + client.batch_mutate(keyed_mutations, ConsistencyLevel.ZERO) + + for sc in _SUPER_COLUMNS: + for key in keys: + waitfor(ZERO_WAIT, _assert_no_columnpath, key, ColumnPath('Super1', super_column=sc.name)) def test_batch_mutate_insertions_and_deletions(self): _empty_login('Keyspace1') @@ -503,13 +548,6 @@ class TestMutations(ThriftTester): super_column='sc1', column=c)) - def test_batch_mutate_validates_deletions(self): - _empty_login('Keyspace1') - def empty_deletion(): - client.batch_mutate({'key_33': {'Standard1': [Mutation(deletion=Deletion(2))]}}, - ConsistencyLevel.ONE) - _expect_exception(empty_deletion, InvalidRequestException) - def test_batch_mutate_does_not_accept_cosc_and_deletion_in_same_mutation(self): def too_full(): _empty_login('Keyspace1') @@ -996,6 +1034,7 @@ class TestMutations(ThriftTester): _expect_missing(lambda: client.get('key1', ColumnPath('Super1', 'sc1'), ConsistencyLevel.ONE)) def test_super_reinsert(self): + _empty_login('Keyspace1') for x in xrange(3): client.insert('key1', ColumnParent('Super1', 'sc2'), Column(_i64(x), 'value', 1), ConsistencyLevel.ONE) @@ -1081,6 +1120,7 @@ class TestMutations(ThriftTester): def test_simple_expiration(self): """ Test that column ttled do expires """ + _empty_login('Keyspace1') column = Column('cttl3', 'value1', 0, 2) client.insert('key1', ColumnParent('Standard1'), column, ConsistencyLevel.ONE) time.sleep(1) @@ -1092,6 +1132,7 @@ class TestMutations(ThriftTester): def test_update_expiring(self): """ Test that updating a column with ttl override the ttl """ + _empty_login('Keyspace1') column1 = Column('cttl4', 'value1', 0, 1) client.insert('key1', ColumnParent('Standard1'), column1, ConsistencyLevel.ONE) column2 = Column('cttl4', 'value1', 1) @@ -1101,6 +1142,7 @@ class TestMutations(ThriftTester): def test_remove_expiring(self): """ Test removing a column with ttl """ + _empty_login('Keyspace1') column = Column('cttl5', 'value1', 0, 10) client.insert('key1', ColumnParent('Standard1'), column, ConsistencyLevel.ONE) client.remove('key1', ColumnPath('Standard1', column='cttl5'), 1, ConsistencyLevel.ONE)