cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [1/2] git commit: Properly error out on CREATE INDEX on counter tables
Date Wed, 09 Oct 2013 14:52:48 GMT
Updated Branches:
  refs/heads/cassandra-2.0 2f31bde61 -> cce686343


Properly error out on CREATE INDEX on counter tables

patch by slebresne; reviewed by jbellis for CASSANDRA-6160


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

Branch: refs/heads/cassandra-2.0
Commit: 1bba280b790a9abf1f96048e3566a0fbaa854141
Parents: d30e328
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Oct 9 16:50:22 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Oct 9 16:50:22 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bba280b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index aa43124..59cc0f1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -18,6 +18,7 @@
  * Trace index selection (CASSANDRA-6001)
  * Update sstablesPerReadHistogram to use biased sampling (CASSANDRA-6164)
  * Log UnknownColumnfamilyException when closing socket (CASSANDRA-5725)
+ * Properly error out on CREATE INDEX for counters table (CASSANDRA-6160)
 
 
 1.2.10

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1bba280b/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 b79a255..3e2ff68 100644
--- a/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
@@ -67,6 +67,9 @@ public class CreateIndexStatement extends SchemaAlteringStatement
     public void validate(ClientState state) throws RequestValidationException
     {
         CFMetaData cfm = ThriftValidation.validateColumnFamily(keyspace(), columnFamily());
+        if (cfm.getDefaultValidator().isCommutative())
+            throw new InvalidRequestException("Secondary indexes are not supported on counter
tables");
+
         CFDefinition.Name name = cfm.getCfDef().get(columnName);
 
         if (name == null)


Mime
View raw message