You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2014/12/16 20:33:26 UTC

cassandra git commit: Fix validation of indexes on composite column components of COMPACT tables

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 9dc9185f5 -> 345e69e1c


Fix validation of indexes on composite column components of COMPACT tables

patch by slebresne; reviewed by thobbs for CASSANDRA-8156


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/345e69e1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/345e69e1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/345e69e1

Branch: refs/heads/cassandra-2.0
Commit: 345e69e1c197faf73f303034c9a895b1dac65402
Parents: 9dc9185
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Dec 16 20:32:08 2014 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Dec 16 20:32:08 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                      | 1 +
 .../apache/cassandra/cql3/statements/CreateIndexStatement.java   | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/345e69e1/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6cecf99..d429f2e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.12:
+ * Fix validation of indexes in COMPACT tables (CASSANDRA-8156)
  * Avoid StackOverflowError when a large list of IN values
    is used for a clustering column (CASSANDRA-8410)
  * Fix NPE when writetime() or ttl() calls are wrapped by

http://git-wip-us.apache.org/repos/asf/cassandra/blob/345e69e1/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java b/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
index e173e8c..5710290 100644
--- a/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
@@ -85,8 +85,8 @@ public class CreateIndexStatement extends SchemaAlteringStatement
         properties.validate();
 
         // TODO: we could lift that limitation
-        if (cfm.getCfDef().isCompact && cd.type != ColumnDefinition.Type.REGULAR)
-            throw new InvalidRequestException(String.format("Secondary index on %s column %s is not yet supported for compact table", cd.type, columnName));
+        if ((cfm.getCfDef().isCompact || !cfm.getCfDef().isComposite) && cd.type != ColumnDefinition.Type.REGULAR)
+            throw new InvalidRequestException("Secondary indexes are not supported on PRIMARY KEY columns in COMPACT STORAGE tables");
 
         // It would be possible to support 2ndary index on static columns (but not without modifications of at least ExtendedFilter and
         // CompositesIndex) and maybe we should, but that means a query like: