Author: gdusbabek
Date: Wed May 26 19:03:55 2010
New Revision: 948541
URL: http://svn.apache.org/viewvc?rev=948541&view=rev
Log:
CFMeta.subcolumncomparator should default to BytesType if cftype==Super. patch
by gdusbabek, reviewed by jbellis. CASSANDRA-1122
Modified:
cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
cassandra/trunk/test/system/test_thrift_server.py
Modified: cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
URL:
http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java?rev=948541&r1=948540&r2=948541&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Wed
May 26 19:03:55 2010
@@ -120,13 +120,15 @@ public final class CFMetaData
this.cfType = cfType;
this.clockType = clockType;
this.comparator = comparator;
- this.subcolumnComparator = subcolumnComparator;
+ // the default subcolumncomparator is null per thrift spec, but only
should be null if cfType == Standard. If
+ // cfType == Super, subcolumnComparator should default to BytesType if
not set.
+ this.subcolumnComparator = subcolumnComparator == null && cfType ==
ColumnFamilyType.Super ? new BytesType() : subcolumnComparator;
this.comment = comment;
this.rowCacheSize = rowCacheSize;
this.preloadRowCache = preloadRowCache;
this.keyCacheSize = keyCacheSize;
this.readRepairChance = readRepairChance;
- this.cfId = cfId;
+ this.cfId = cfId;
}
/** adds this cfm to the map. */
Modified: cassandra/trunk/test/system/test_thrift_server.py
URL:
http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_thrift_server.py?rev=948541&r1=948540&r2=948541&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_thrift_server.py (original)
+++ cassandra/trunk/test/system/test_thrift_server.py Wed May 26 19:03:55 2010
@@ -1106,6 +1106,29 @@ class TestMutations(ThriftTester):
assert 'NewColumnFamily' not in ks1
assert 'Standard1' in ks1
+ def test_system_super_column_family_operations(self):
+ """test cf (add, drop, rename) operations"""
+ _set_keyspace('Keyspace1')
+
+ # create
+ newcf = CfDef('Keyspace1', 'NewSuperColumnFamily', 'Super')
+ client.system_add_column_family(newcf)
+ ks1 = client.describe_keyspace('Keyspace1')
+ assert 'NewSuperColumnFamily' in ks1
+
+ # rename
+ client.system_rename_column_family('Keyspace1',
'NewSuperColumnFamily', 'RenameSuperColumnFamily')
+ ks1 = client.describe_keyspace('Keyspace1')
+ assert 'RenameSuperColumnFamily' in ks1
+ assert 'NewSuperColumnFamily' not in ks1
+
+ # drop
+ client.system_drop_column_family('Keyspace1',
'RenameSuperColumnFamily')
+ ks1 = client.describe_keyspace('Keyspace1')
+ assert 'RenameSuperColumnFamily' not in ks1
+ assert 'NewSuperColumnFamily' not in ks1
+ assert 'Standard1' in ks1
+
def test_insert_ttl(self):
""" Test simple insertion of a column with ttl """
_set_keyspace('Keyspace1')