From e324ef90519ffe2b9068ad852c8115ff8a7a1075 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Mon, 6 Jul 2009 20:07:52 +0000 Subject: [PATCH] disallow specifying ColumnSort on supercolumns. patch by jbellis; reviewed by Evan Weaver for CASSANDRA-251 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@791598 13f79535-47bb-0310-9956-ffa450edef68 --- conf/storage-conf.xml | 7 ++++++- .../org/apache/cassandra/config/DatabaseDescriptor.java | 8 ++++++-- test/conf/storage-conf.xml | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/conf/storage-conf.xml b/conf/storage-conf.xml index e79f4c6ab5..a5653ad16b 100644 --- a/conf/storage-conf.xml +++ b/conf/storage-conf.xml @@ -30,6 +30,11 @@ (ColumnFamilies are closer in meaning to those.) There is an implicit table named 'system' for Cassandra internals. + + The default ColumnSort is Time for standard column families. + For super column families, specifying ColumnSort is not supported; + the supercolumns themselves are always name-sorted and their subcolumns + are always time-sorted. --> @@ -51,7 +56,7 @@ - +
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java index 8d4e35a6f6..68d73067a8 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -350,9 +350,13 @@ public class DatabaseDescriptor { throw new ConfigurationException("invalid column sort value " + rawColumnIndexType); } - if ("Super".equals(columnType) && !"Name".equals(columnIndexType)) + if ("Super".equals(columnType)) { - throw new ConfigurationException("Super columnfamilies may only be name-sorted"); + if (rawColumnIndexType != null) + { + throw new ConfigurationException("Super columnfamilies are always name-sorted, and their subcolumns are always time-sorted. You may not specify the ColumnSort attribute on a SuperColumn."); + } + columnIndexType = "Name"; } // see if flush period is set diff --git a/test/conf/storage-conf.xml b/test/conf/storage-conf.xml index 6332c22774..8bdffac7fe 100644 --- a/test/conf/storage-conf.xml +++ b/test/conf/storage-conf.xml @@ -45,8 +45,8 @@ - - + +