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 2013/10/09 16:52:48 UTC
[1/2] git commit: Properly error out on CREATE INDEX on counter tables
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 <sy...@datastax.com>
Authored: Wed Oct 9 16:50:22 2013 +0200
Committer: Sylvain Lebresne <sy...@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)
[2/2] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0
Posted by sl...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0
Conflicts:
src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cce68634
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cce68634
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cce68634
Branch: refs/heads/cassandra-2.0
Commit: cce6863432803b5b3c278eae6f2e58b13ad069bd
Parents: 2f31bde 1bba280
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Wed Oct 9 16:52:38 2013 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Wed Oct 9 16:52:38 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/cce68634/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 87a5cda,59cc0f1..53de29e
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -43,43 -18,10 +43,44 @@@ Merged from 1.2
* 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
+2.0.1
+ * Fix bug that could allow reading deleted data temporarily (CASSANDRA-6025)
+ * Improve memory use defaults (CASSANDRA-5069)
+ * Make ThriftServer more easlly extensible (CASSANDRA-6058)
+ * Remove Hadoop dependency from ITransportFactory (CASSANDRA-6062)
+ * add file_cache_size_in_mb setting (CASSANDRA-5661)
+ * Improve error message when yaml contains invalid properties (CASSANDRA-5958)
+ * Improve leveled compaction's ability to find non-overlapping L0 compactions
+ to work on concurrently (CASSANDRA-5921)
+ * Notify indexer of columns shadowed by range tombstones (CASSANDRA-5614)
+ * Log Merkle tree stats (CASSANDRA-2698)
+ * Switch from crc32 to adler32 for compressed sstable checksums (CASSANDRA-5862)
+ * Improve offheap memcpy performance (CASSANDRA-5884)
+ * Use a range aware scanner for cleanup (CASSANDRA-2524)
+ * Cleanup doesn't need to inspect sstables that contain only local data
+ (CASSANDRA-5722)
+ * Add ability for CQL3 to list partition keys (CASSANDRA-4536)
+ * Improve native protocol serialization (CASSANDRA-5664)
+ * Upgrade Thrift to 0.9.1 (CASSANDRA-5923)
+ * Require superuser status for adding triggers (CASSANDRA-5963)
+ * Make standalone scrubber handle old and new style leveled manifest
+ (CASSANDRA-6005)
+ * Fix paxos bugs (CASSANDRA-6012, 6013, 6023)
+ * Fix paged ranges with multiple replicas (CASSANDRA-6004)
+ * Fix potential AssertionError during tracing (CASSANDRA-6041)
+ * Fix NPE in sstablesplit (CASSANDRA-6027)
+ * Migrate pre-2.0 key/value/column aliases to system.schema_columns
+ (CASSANDRA-6009)
+ * Paging filter empty rows too agressively (CASSANDRA-6040)
+ * Support variadic parameters for IN clauses (CASSANDRA-4210)
+ * cqlsh: return the result of CAS writes (CASSANDRA-5796)
+ * Fix validation of IN clauses with 2ndary indexes (CASSANDRA-6050)
+ * Support named bind variables in CQL (CASSANDRA-6033)
+Merged from 1.2:
+ * Allow cache-keys-to-save to be set at runtime (CASSANDRA-5980)
* Avoid second-guessing out-of-space state (CASSANDRA-5605)
* Tuning knobs for dealing with large blobs and many CFs (CASSANDRA-5982)
* (Hadoop) Fix CQLRW for thrift tables (CASSANDRA-6002)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cce68634/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
index 9de7106,3e2ff68..ba88e28
--- a/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
@@@ -64,34 -66,36 +64,37 @@@ public class CreateIndexStatement exten
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);
+ ColumnDefinition cd = cfm.getColumnDefinition(columnName.key);
- if (name == null)
+ if (cd == null)
throw new InvalidRequestException("No column definition found for column " + columnName);
- switch (name.kind)
+ if (cd.getIndexType() != null)
{
- case KEY_ALIAS:
- case COLUMN_ALIAS:
- throw new InvalidRequestException(String.format("Cannot create index on PRIMARY KEY part %s", columnName));
- case VALUE_ALIAS:
- throw new InvalidRequestException(String.format("Cannot create index on column %s of compact CF", columnName));
- case COLUMN_METADATA:
- ColumnDefinition cd = cfm.getColumnDefinition(columnName.key);
- if (cd.getIndexType() != null)
- throw new InvalidRequestException("Index already exists");
- if (isCustom && indexClass == null)
- throw new InvalidRequestException("CUSTOM index requires specifiying the index class");
- if (!isCustom && indexClass != null)
- throw new InvalidRequestException("Cannot specify index class for a non-CUSTOM index");
- if (cd.getValidator().isCollection() && !isCustom)
- throw new InvalidRequestException("Indexes on collections are no yet supported");
- break;
- default:
- throw new AssertionError();
+ if (ifNotExists)
+ return;
+ else
+ throw new InvalidRequestException("Index already exists");
}
+
+ if (isCustom && indexClass == null)
+ throw new InvalidRequestException("CUSTOM index requires specifiying the index class");
+
+ if (!isCustom && indexClass != null)
+ throw new InvalidRequestException("Cannot specify index class for a non-CUSTOM index");
+
+ // 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 (cd.getValidator().isCollection() && !isCustom)
+ throw new InvalidRequestException("Indexes on collections are no yet supported");
+
+ if (cd.type == ColumnDefinition.Type.PARTITION_KEY && cd.componentIndex == null)
+ throw new InvalidRequestException(String.format("Cannot add secondary index to already primarily indexed column %s", columnName));
}
public void announceMigration() throws InvalidRequestException, ConfigurationException