cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r819662 - in /incubator/cassandra/trunk: ./ interface/gen-java/org/apache/cassandra/service/ src/java/org/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/service/ test/system/ test/unit/org/
Date Mon, 28 Sep 2009 17:46:49 GMT
Author: jbellis
Date: Mon Sep 28 17:46:48 2009
New Revision: 819662

URL: http://svn.apache.org/viewvc?rev=819662&view=rev
Log:
merge from 0.4 branch

Modified:
    incubator/cassandra/trunk/   (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/NotFoundException.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java
  (props changed)
    incubator/cassandra/trunk/src/java/org/   (props changed)
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java
    incubator/cassandra/trunk/test/system/test_server.py
    incubator/cassandra/trunk/test/unit/org/   (props changed)

Propchange: incubator/cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,2 +1,2 @@
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
-/incubator/cassandra/branches/cassandra-0.4:810145-819121
+/incubator/cassandra/branches/cassandra-0.4:810145-819661

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-819121
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-819661
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,4 +1,4 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-819121
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-819661
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java:749219-794428
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/column_t.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-819121
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-819661
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-819121
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-819661
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,4 +1,4 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-819121
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-819661
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:749219-794428
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:749219-768588

Propchange: incubator/cassandra/trunk/src/java/org/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/src/java/org:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/src/java/org:810145-819121
+/incubator/cassandra/branches/cassandra-0.4/src/java/org:810145-819661
 /incubator/cassandra/trunk/src/java/org:749219-769885

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java?rev=819662&r1=819661&r2=819662&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java Mon Sep 28 17:46:48
2009
@@ -65,6 +65,7 @@
     {
         assert name != null;
         assert value != null;
+        assert name.length <= IColumn.MAX_NAME_LENGTH;
         this.name = name;
         this.value = value;
         this.timestamp = timestamp;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java?rev=819662&r1=819661&r2=819662&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnSerializer.java Mon Sep
28 17:46:48 2009
@@ -32,7 +32,7 @@
     public static void writeName(byte[] name, DataOutput out) throws IOException
     {
         int length = name.length;
-        assert length <= 65535;
+        assert length <= IColumn.MAX_NAME_LENGTH;
         out.writeByte((length >> 8) & 0xFF);
         out.writeByte(length & 0xFF);
         out.write(name);

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java?rev=819662&r1=819661&r2=819662&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java Mon Sep 28 17:46:48
2009
@@ -25,6 +25,8 @@
 public interface IColumn
 {
     public static short UtfPrefix_ = 2;
+    public static final int MAX_NAME_LENGTH = 0xFFFF; // we use 2 bytes to hold length
+
     public boolean isMarkedForDelete();
     public long getMarkedForDeleteAt();
     public long mostRecentChangeAt();

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java?rev=819662&r1=819661&r2=819662&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java Mon Sep 28
17:46:48 2009
@@ -51,6 +51,8 @@
 
     SuperColumn(byte[] name, AbstractType comparator)
     {
+        assert name != null;
+        assert name.length <= IColumn.MAX_NAME_LENGTH;
     	name_ = name;
         columns_ = new ConcurrentSkipListMap<byte[], IColumn>(comparator);
     }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java?rev=819662&r1=819661&r2=819662&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ThriftValidation.java
Mon Sep 28 17:46:48 2009
@@ -28,6 +28,7 @@
 import org.apache.cassandra.db.KeyspaceNotDefinedException;
 import org.apache.cassandra.db.ColumnFamilyNotDefinedException;
 import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.IColumn;
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.MarshalException;
 import org.apache.cassandra.config.DatabaseDescriptor;
@@ -148,9 +149,20 @@
     private static void validateColumns(String keyspace, String columnFamilyName, byte[]
superColumnName, Iterable<byte[]> column_names)
     throws InvalidRequestException
     {
+        if (superColumnName != null)
+        {
+            if (superColumnName.length > IColumn.MAX_NAME_LENGTH)
+                throw new InvalidRequestException("supercolumn name length must not be greater
than " + IColumn.MAX_NAME_LENGTH);
+            if (superColumnName.length == 0)
+                throw new InvalidRequestException("supercolumn name must not be empty");
+        }
         AbstractType comparator = ColumnFamily.getComparatorFor(keyspace, columnFamilyName,
superColumnName);
         for (byte[] name : column_names)
         {
+            if (name.length > IColumn.MAX_NAME_LENGTH)
+                throw new InvalidRequestException("column name length must not be greater
than " + IColumn.MAX_NAME_LENGTH);
+            if (name.length == 0)
+                throw new InvalidRequestException("column name must not be empty");
             try
             {
                 comparator.validate(name);

Modified: incubator/cassandra/trunk/test/system/test_server.py
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/system/test_server.py?rev=819662&r1=819661&r2=819662&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/system/test_server.py (original)
+++ incubator/cassandra/trunk/test/system/test_server.py Mon Sep 28 17:46:48 2009
@@ -274,6 +274,18 @@
         _insert_batch(True)
         _verify_batch()
 
+    def test_column_name_lengths(self):
+        _expect_exception(lambda: client.insert('Keyspace1', 'key1', ColumnPath('Standard1',
column=''), 'value', 0, ConsistencyLevel.ONE), InvalidRequestException)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*1), 'value',
0, ConsistencyLevel.ONE)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*127), 'value',
0, ConsistencyLevel.ONE)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*128), 'value',
0, ConsistencyLevel.ONE)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*129), 'value',
0, ConsistencyLevel.ONE)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*255), 'value',
0, ConsistencyLevel.ONE)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*256), 'value',
0, ConsistencyLevel.ONE)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*257), 'value',
0, ConsistencyLevel.ONE)
+        client.insert('Keyspace1', 'key1', ColumnPath('Standard1', column='x'*(2**16 - 1)),
'value', 0, ConsistencyLevel.ONE)
+        _expect_exception(lambda: client.insert('Keyspace1', 'key1', ColumnPath('Standard1',
column='x'*(2**16)), 'value', 0, ConsistencyLevel.ONE), InvalidRequestException)
+
     def test_bad_calls(self):
         # supercolumn in a non-super CF
         _expect_exception(lambda: client.insert('Keyspace1', 'key1', ColumnPath('Standard1',
'x', 'y'), 'value', 0, ConsistencyLevel.ONE), InvalidRequestException)

Propchange: incubator/cassandra/trunk/test/unit/org/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 17:46:48 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/test/unit/org:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/test/unit/org:810145-819121
+/incubator/cassandra/branches/cassandra-0.4/test/unit/org:810145-819661
 /incubator/cassandra/trunk/test/unit/org:749219-768583



Mime
View raw message