cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r802977 - in /incubator/cassandra/trunk: conf/log4j.properties src/java/org/apache/cassandra/config/DatabaseDescriptor.java src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java test/conf/storage-conf.xml test/system/test_server.py
Date Tue, 11 Aug 2009 02:09:34 GMT
Author: jbellis
Date: Tue Aug 11 02:09:33 2009
New Revision: 802977

URL: http://svn.apache.org/viewvc?rev=802977&view=rev
Log:
fix typo breaking CompareSubcolumnsWith.  fix timeuuid compare with byte[0].
patch by jbellis; reviewed by Evan Weaver for CASSANDRA-357

Modified:
    incubator/cassandra/trunk/conf/log4j.properties
    incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
    incubator/cassandra/trunk/test/conf/storage-conf.xml
    incubator/cassandra/trunk/test/system/test_server.py

Modified: incubator/cassandra/trunk/conf/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/conf/log4j.properties?rev=802977&r1=802976&r2=802977&view=diff
==============================================================================
--- incubator/cassandra/trunk/conf/log4j.properties (original)
+++ incubator/cassandra/trunk/conf/log4j.properties Tue Aug 11 02:09:33 2009
@@ -18,7 +18,7 @@
 # and the pattern to %c instead of %l.  (%l is slower.)
 
 # output messages into a rolling log file as well as stdout
-log4j.rootLogger=INFO,stdout,R
+log4j.rootLogger=DEBUG,stdout,R
 
 # stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=802977&r1=802976&r2=802977&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Tue Aug 11 02:09:33 2009
@@ -906,7 +906,7 @@
     public static AbstractType getSubComparator(String tableName, String cfName)
     {
         assert tableName != null;
-        return getCFMetaData(tableName, cfName).comparator;
+        return getCFMetaData(tableName, cfName).subcolumnComparator;
     }
 
     public static Map<String, Map<String, CFMetaData>> getTableToColumnFamilyMap()

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java?rev=802977&r1=802976&r2=802977&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java Tue
Aug 11 02:09:33 2009
@@ -6,6 +6,15 @@
 {
     public int compare(byte[] o1, byte[] o2)
     {
+        if (o1.length == 0)
+        {
+            return o2.length == 0 ? 0 : -1;
+        }
+        if (o2.length == 0)
+        {
+            return 1;
+        }
+        
         long t1 = LexicalUUIDType.getUUID(o1).timestamp();
         long t2 = LexicalUUIDType.getUUID(o2).timestamp();
         return t1 < t2 ? -1 : (t1 > t2 ? 1 : 0);

Modified: incubator/cassandra/trunk/test/conf/storage-conf.xml
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/conf/storage-conf.xml?rev=802977&r1=802976&r2=802977&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/conf/storage-conf.xml (original)
+++ incubator/cassandra/trunk/test/conf/storage-conf.xml Tue Aug 11 02:09:33 2009
@@ -55,6 +55,7 @@
        <ColumnFamily Name="Standard1"/>
        <ColumnFamily Name="Standard3"/>
        <ColumnFamily ColumnType="Super" Name="Super3"/>
+       <ColumnFamily ColumnType="Super" CompareSubcolumnsWith="TimeUUIDType" Name="Super4"/>
      </Keyspace>
    </Keyspaces>
    <Seeds>

Modified: incubator/cassandra/trunk/test/system/test_server.py
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/system/test_server.py?rev=802977&r1=802976&r2=802977&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/system/test_server.py (original)
+++ incubator/cassandra/trunk/test/system/test_server.py Tue Aug 11 02:09:33 2009
@@ -179,7 +179,26 @@
                  for result in client.get_slice('Keyspace1', 'key1', column_parent, p, ConsistencyLevel.ONE)]
         assert slice == [Column(_i64(6), 'value6', 0)], slice
         
-
+    def test_time_uuid(self):
+        import uuid
+        L = []
+        # 100 isn't enough to fail reliably if the comparator is borked
+        for i in xrange(500):
+            L.append(uuid.uuid1())
+            client.insert('Keyspace2', 'key1', ColumnPath('Super4', 'sc1', L[-1].bytes),
'value%s' % i, i, ConsistencyLevel.ONE)
+        slice = _big_slice('Keyspace2', 'key1', ColumnParent('Super4', 'sc1'))
+        assert len(slice) == 500
+        for i in xrange(500):
+            u = slice[i].column
+            assert u.value == 'value%s' % i
+            assert u.name == L[i].bytes
+
+        p = SlicePredicate(slice_range=SliceRange('', '', False, 1))
+        column_parent = ColumnParent('Super4', 'sc1')
+        slice = [result.column
+                 for result in client.get_slice('Keyspace2', 'key1', column_parent, p, ConsistencyLevel.ONE)]
+        assert slice == [Column(L[-1].bytes, 'value499', 499)], slice
+        
     def test_batch_insert(self):
         _insert_batch(False)
         time.sleep(0.1)



Mime
View raw message