You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2017/03/23 16:47:45 UTC
[3/3] cassandra git commit: Merge branch cassandra-3.11 into trunk
Merge branch cassandra-3.11 into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/18c6ed25
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/18c6ed25
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/18c6ed25
Branch: refs/heads/trunk
Commit: 18c6ed25e30c0cc444d7cfda929ef7677309c57b
Parents: 9330409 82d3cdc
Author: Benjamin Lerer <b....@gmail.com>
Authored: Thu Mar 23 17:45:54 2017 +0100
Committer: Benjamin Lerer <b....@gmail.com>
Committed: Thu Mar 23 17:45:54 2017 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../cassandra/cql3/SingleColumnRelation.java | 6 ++
.../cql3/statements/CreateIndexStatement.java | 2 +
.../validation/entities/SecondaryIndexTest.java | 103 +++++++++++++++++++
.../SelectSingleColumnRelationTest.java | 24 +++++
5 files changed, 136 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/18c6ed25/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index a5145a6,6644796..09e206e
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,51 -1,5 +1,52 @@@
+4.0
+ * Upgrade junit from 4.6 to 4.12 (CASSANDRA-13360)
+ * Cleanup ParentRepairSession after repairs (CASSANDRA-13359)
+ * Incremental repair not streaming correct sstables (CASSANDRA-13328)
+ * Upgrade the jna version to 4.3.0 (CASSANDRA-13300)
+ * Add the currentTimestamp, currentDate, currentTime and currentTimeUUID functions (CASSANDRA-13132)
+ * Remove config option index_interval (CASSANDRA-10671)
+ * Reduce lock contention for collection types and serializers (CASSANDRA-13271)
+ * Make it possible to override MessagingService.Verb ids (CASSANDRA-13283)
+ * Avoid synchronized on prepareForRepair in ActiveRepairService (CASSANDRA-9292)
+ * Adds the ability to use uncompressed chunks in compressed files (CASSANDRA-10520)
+ * Don't flush sstables when streaming for incremental repair (CASSANDRA-13226)
+ * Remove unused method (CASSANDRA-13227)
+ * Fix minor bugs related to #9143 (CASSANDRA-13217)
+ * Output warning if user increases RF (CASSANDRA-13079)
+ * Remove pre-3.0 streaming compatibility code for 4.0 (CASSANDRA-13081)
+ * Add support for + and - operations on dates (CASSANDRA-11936)
+ * Fix consistency of incrementally repaired data (CASSANDRA-9143)
+ * Increase commitlog version (CASSANDRA-13161)
+ * Make TableMetadata immutable, optimize Schema (CASSANDRA-9425)
+ * Refactor ColumnCondition (CASSANDRA-12981)
+ * Parallelize streaming of different keyspaces (CASSANDRA-4663)
+ * Improved compactions metrics (CASSANDRA-13015)
+ * Speed-up start-up sequence by avoiding un-needed flushes (CASSANDRA-13031)
+ * Use Caffeine (W-TinyLFU) for on-heap caches (CASSANDRA-10855)
+ * Thrift removal (CASSANDRA-11115)
+ * Remove pre-3.0 compatibility code for 4.0 (CASSANDRA-12716)
+ * Add column definition kind to dropped columns in schema (CASSANDRA-12705)
+ * Add (automate) Nodetool Documentation (CASSANDRA-12672)
+ * Update bundled cqlsh python driver to 3.7.0 (CASSANDRA-12736)
+ * Reject invalid replication settings when creating or altering a keyspace (CASSANDRA-12681)
+ * Clean up the SSTableReader#getScanner API wrt removal of RateLimiter (CASSANDRA-12422)
+ * Use new token allocation for non bootstrap case as well (CASSANDRA-13080)
+ * Avoid byte-array copy when key cache is disabled (CASSANDRA-13084)
+ * Require forceful decommission if number of nodes is less than replication factor (CASSANDRA-12510)
+ * Allow IN restrictions on column families with collections (CASSANDRA-12654)
+ * Log message size in trace message in OutboundTcpConnection (CASSANDRA-13028)
+ * Add timeUnit Days for cassandra-stress (CASSANDRA-13029)
+ * Add mutation size and batch metrics (CASSANDRA-12649)
+ * Add method to get size of endpoints to TokenMetadata (CASSANDRA-12999)
+ * Expose time spent waiting in thread pool queue (CASSANDRA-8398)
+ * Conditionally update index built status to avoid unnecessary flushes (CASSANDRA-12969)
+ * cqlsh auto completion: refactor definition of compaction strategy options (CASSANDRA-12946)
+ * Add support for arithmetic operators (CASSANDRA-11935)
+ * Add histogram for delay to deliver hints (CASSANDRA-13234)
+
+
3.11.0
+ * Forbid SELECT restrictions and CREATE INDEX over non-frozen UDT columns (CASSANDRA-13247)
* Default logging we ship will incorrectly print "?:?" for "%F:%L" pattern (CASSANDRA-13317)
* Possible AssertionError in UnfilteredRowIteratorWithLowerBound (CASSANDRA-13366)
* Support unaligned memory access for AArch64 (CASSANDRA-13326)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/18c6ed25/src/java/org/apache/cassandra/cql3/SingleColumnRelation.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/18c6ed25/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/18c6ed25/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
index 68a3378,013e41d..ffe9581
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java
@@@ -1395,13 -1409,117 +1395,116 @@@ public class SecondaryIndexTest extend
"CREATE INDEX ON %s (t)");
}
+ @Test
+ public void testIndexOnFrozenUDT() throws Throwable
+ {
+ String type = createType("CREATE TYPE %s (a int)");
+ String tableName = createTable("CREATE TABLE %s (k int PRIMARY KEY, v frozen<" + type + ">)");
+
+ Object udt1 = userType("a", 1);
+ Object udt2 = userType("a", 2);
+
+ execute("INSERT INTO %s (k, v) VALUES (?, ?)", 0, udt1);
+ execute("CREATE INDEX idx ON %s (v)");
+ execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, udt2);
+ execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, udt1);
+ assertTrue(waitForIndex(keyspace(), tableName, "idx"));
+
+ assertRows(execute("SELECT * FROM %s WHERE v = ?", udt1), row(1, udt1), row(0, udt1));
+ assertEmpty(execute("SELECT * FROM %s WHERE v = ?", udt2));
+
+ execute("DELETE FROM %s WHERE k = 0");
+ assertRows(execute("SELECT * FROM %s WHERE v = ?", udt1), row(1, udt1));
+
+ dropIndex("DROP INDEX %s.idx");
+ assertInvalidMessage("Index 'idx' could not be found", "DROP INDEX " + KEYSPACE + ".idx");
+ assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
+ "SELECT * FROM %s WHERE v = ?", udt1);
+ }
+
+ @Test
+ public void testIndexOnFrozenCollectionOfUDT() throws Throwable
+ {
+ String type = createType("CREATE TYPE %s (a int)");
+ String tableName = createTable("CREATE TABLE %s (k int PRIMARY KEY, v frozen<set<frozen<" + type + ">>>)");
+
+ Object udt1 = userType("a", 1);
+ Object udt2 = userType("a", 2);
+
+ execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, set(udt1, udt2));
+ assertInvalidMessage("Frozen collections only support full()", "CREATE INDEX idx ON %s (keys(v))");
+ assertInvalidMessage("Frozen collections only support full()", "CREATE INDEX idx ON %s (values(v))");
+ execute("CREATE INDEX idx ON %s (full(v))");
+
+ execute("INSERT INTO %s (k, v) VALUES (?, ?)", 2, set(udt2));
+ assertTrue(waitForIndex(keyspace(), tableName, "idx"));
+
+ assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
+ "SELECT * FROM %s WHERE v CONTAINS ?", udt1);
+
+ assertRows(execute("SELECT * FROM %s WHERE v = ?", set(udt1, udt2)), row(1, set(udt1, udt2)));
+ assertRows(execute("SELECT * FROM %s WHERE v = ?", set(udt2)), row(2, set(udt2)));
+
+ execute("DELETE FROM %s WHERE k = 2");
+ assertEmpty(execute("SELECT * FROM %s WHERE v = ?", set(udt2)));
+
+ dropIndex("DROP INDEX %s.idx");
+ assertInvalidMessage("Index 'idx' could not be found", "DROP INDEX " + KEYSPACE + ".idx");
+ assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
+ "SELECT * FROM %s WHERE v CONTAINS ?", udt1);
+ }
+
+ @Test
+ public void testIndexOnNonFrozenCollectionOfFrozenUDT() throws Throwable
+ {
+ String type = createType("CREATE TYPE %s (a int)");
+ String tableName = createTable("CREATE TABLE %s (k int PRIMARY KEY, v set<frozen<" + type + ">>)");
+
+ Object udt1 = userType("a", 1);
+ Object udt2 = userType("a", 2);
+
+ execute("INSERT INTO %s (k, v) VALUES (?, ?)", 1, set(udt1));
+ assertInvalidMessage("Cannot create index on keys of column v with non-map type",
+ "CREATE INDEX idx ON %s (keys(v))");
+ assertInvalidMessage("full() indexes can only be created on frozen collections",
+ "CREATE INDEX idx ON %s (full(v))");
+ execute("CREATE INDEX idx ON %s (values(v))");
+
+ execute("INSERT INTO %s (k, v) VALUES (?, ?)", 2, set(udt2));
+ execute("UPDATE %s SET v = v + ? WHERE k = ?", set(udt2), 1);
+ assertTrue(waitForIndex(keyspace(), tableName, "idx"));
+
+ assertRows(execute("SELECT * FROM %s WHERE v CONTAINS ?", udt1), row(1, set(udt1, udt2)));
+ assertRows(execute("SELECT * FROM %s WHERE v CONTAINS ?", udt2), row(1, set(udt1, udt2)), row(2, set(udt2)));
+
+ execute("DELETE FROM %s WHERE k = 1");
+ assertEmpty(execute("SELECT * FROM %s WHERE v CONTAINS ?", udt1));
+ assertRows(execute("SELECT * FROM %s WHERE v CONTAINS ?", udt2), row(2, set(udt2)));
+
+ dropIndex("DROP INDEX %s.idx");
+ assertInvalidMessage("Index 'idx' could not be found", "DROP INDEX " + KEYSPACE + ".idx");
+ assertInvalidMessage(StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE,
+ "SELECT * FROM %s WHERE v CONTAINS ?", udt1);
+ }
+
+ @Test
+ public void testIndexOnNonFrozenUDT() throws Throwable
+ {
+ String type = createType("CREATE TYPE %s (a int)");
+ createTable("CREATE TABLE %s (k int PRIMARY KEY, v " + type + ")");
+ assertInvalidMessage("Secondary indexes are not supported on non-frozen UDTs", "CREATE INDEX ON %s (v)");
+ assertInvalidMessage("Non-collection columns support only simple indexes", "CREATE INDEX ON %s (keys(v))");
+ assertInvalidMessage("Non-collection columns support only simple indexes", "CREATE INDEX ON %s (values(v))");
+ assertInvalidMessage("full() indexes can only be created on frozen collections", "CREATE INDEX ON %s (full(v))");
+ }
+
- private ResultMessage.Prepared prepareStatement(String cql, boolean forThrift)
+ private ResultMessage.Prepared prepareStatement(String cql)
{
return QueryProcessor.prepare(String.format(cql, KEYSPACE, currentTable()),
- ClientState.forInternalCalls(),
- forThrift);
+ ClientState.forInternalCalls());
}
- private void validateCell(Cell cell, ColumnDefinition def, ByteBuffer val, long timestamp)
+ private void validateCell(Cell cell, ColumnMetadata def, ByteBuffer val, long timestamp)
{
assertNotNull(cell);
assertEquals(0, def.type.compare(cell.value(), val));