cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1050426 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/thrift/ThriftValidation.java test/system/test_thrift_server.py
Date Fri, 17 Dec 2010 15:34:01 GMT
Author: jbellis
Date: Fri Dec 17 15:34:01 2010
New Revision: 1050426

URL: http://svn.apache.org/viewvc?rev=1050426&view=rev
Log:
return InvalidRequest when remove ofsubcolumn without supercolumn is requested
patch by thobbs; reviewed by jbellis for CASSANDRA-1866

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/thrift/ThriftValidation.java
    cassandra/branches/cassandra-0.7/test/system/test_thrift_server.py

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1050426&r1=1050425&r2=1050426&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Fri Dec 17 15:34:01 2010
@@ -14,6 +14,8 @@ dev
  * deleted columns resurrected after a flush on slice read path 
    (CASSANDRA-1837)
  * ReadResponseResolver check digests against each other (CASSANDRA-1830)
+ * return InvalidRequest when remove of subcolumn without supercolumn
+   is requested (CASSANDRA-1866)
 
 
 0.7.0-rc2

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/thrift/ThriftValidation.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=1050426&r1=1050425&r2=1050426&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/thrift/ThriftValidation.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/thrift/ThriftValidation.java
Fri Dec 17 15:34:01 2010
@@ -141,6 +141,13 @@ public class ThriftValidation
                 throw new InvalidRequestException("supercolumn may not be specified for standard
CF " + column_path_or_parent.column_family);
             }
         }
+        if (cfType == ColumnFamilyType.Super)
+        {
+            if (column_path_or_parent.super_column == null && column_path_or_parent.column
!= null)
+            {
+                throw new InvalidRequestException("A column cannot be specified without specifying
a super column for removal on super CF " + column_path_or_parent.column_family);
+            }
+        }
         if (column_path_or_parent.column != null)
         {
             validateColumns(tablename, column_path_or_parent.column_family, column_path_or_parent.super_column,
Arrays.asList(column_path_or_parent.column));

Modified: cassandra/branches/cassandra-0.7/test/system/test_thrift_server.py
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/system/test_thrift_server.py?rev=1050426&r1=1050425&r2=1050426&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/system/test_thrift_server.py (original)
+++ cassandra/branches/cassandra-0.7/test/system/test_thrift_server.py Fri Dec 17 15:34:01
2010
@@ -779,6 +779,11 @@ class TestMutations(ThriftTester):
                                                                    Column(_i64(7), 'value7',
0)])]
         assert super_columns == super_columns_expected, super_columns
 
+        # shouldn't be able to specify a column w/o a super column for remove
+        cp = ColumnPath(column_family='Super1', column='sc2')
+        e = _expect_exception(lambda: client.remove('key1', cp, 5, ConsistencyLevel.ONE),
InvalidRequestException)
+        assert e.why.find("column cannot be specified without") >= 0
+
     def test_super_cf_remove_supercolumn(self):
         _set_keyspace('Keyspace1')
         



Mime
View raw message