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/977363e1 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/977363e1 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/977363e1 Branch: refs/heads/trunk Commit: 977363e157c5421012e059357f4253fa031198aa Parents: 679c317 eaa3da1 Author: Benjamin Lerer <b.le...@gmail.com> Authored: Mon Jun 26 13:25:18 2017 +0200 Committer: Benjamin Lerer <b.le...@gmail.com> Committed: Mon Jun 26 13:27:58 2017 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/cql3/selection/Selection.java | 2 +- .../cql3/statements/SelectStatement.java | 2 +- .../validation/entities/SecondaryIndexTest.java | 43 ++++++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/977363e1/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index ab06e2b,4297a15..04640ab --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,89 -1,7 +1,90 @@@ +4.0 + * Improve secondary index (re)build failure and concurrency handling (CASSANDRA-10130) + * Improve calculation of available disk space for compaction (CASSANDRA-13068) + * Change the accessibility of RowCacheSerializer for third party row cache plugins (CASSANDRA-13579) + * Allow sub-range repairs for a preview of repaired data (CASSANDRA-13570) + * NPE in IR cleanup when columnfamily has no sstables (CASSANDRA-13585) + * Fix Randomness of stress values (CASSANDRA-12744) + * Allow selecting Map values and Set elements (CASSANDRA-7396) + * Fast and garbage-free Streaming Histogram (CASSANDRA-13444) + * Update repairTime for keyspaces on completion (CASSANDRA-13539) + * Add configurable upper bound for validation executor threads (CASSANDRA-13521) + * Bring back maxHintTTL propery (CASSANDRA-12982) + * Add testing guidelines (CASSANDRA-13497) + * Add more repair metrics (CASSANDRA-13531) + * RangeStreamer should be smarter when picking endpoints for streaming (CASSANDRA-4650) + * Avoid rewrapping an exception thrown for cache load functions (CASSANDRA-13367) + * Log time elapsed for each incremental repair phase (CASSANDRA-13498) + * Add multiple table operation support to cassandra-stress (CASSANDRA-8780) + * Fix incorrect cqlsh results when selecting same columns multiple times (CASSANDRA-13262) + * Fix WriteResponseHandlerTest is sensitive to test execution order (CASSANDRA-13421) + * Improve incremental repair logging (CASSANDRA-13468) + * Start compaction when incremental repair finishes (CASSANDRA-13454) + * Add repair streaming preview (CASSANDRA-13257) + * Cleanup isIncremental/repairedAt usage (CASSANDRA-13430) + * Change protocol to allow sending key space independent of query string (CASSANDRA-10145) + * Make gc_log and gc_warn settable at runtime (CASSANDRA-12661) + * Take number of files in L0 in account when estimating remaining compaction tasks (CASSANDRA-13354) + * Skip building views during base table streams on range movements (CASSANDRA-13065) + * Improve error messages for +/- operations on maps and tuples (CASSANDRA-13197) + * Remove deprecated repair JMX APIs (CASSANDRA-11530) + * Fix version check to enable streaming keep-alive (CASSANDRA-12929) + * Make it possible to monitor an ideal consistency level separate from actual consistency level (CASSANDRA-13289) + * Outbound TCP connections ignore internode authenticator (CASSANDRA-13324) + * Upgrade junit from 4.6 to 4.12 (CASSANDRA-13360) + * Cleanup ParentRepairSession after repairs (CASSANDRA-13359) + * Upgrade snappy-java to 1.1.2.6 (CASSANDRA-13336) + * 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) + * Fix cqlsh automatic protocol downgrade regression (CASSANDRA-13307) + * Changing `max_hint_window_in_ms` at runtime (CASSANDRA-11720) + * Trivial format error in StorageProxy (CASSANDRA-13551) + + 3.11.1 Merged from 3.0: - * Fix secondary index queries on COMPACT tables (CASSANDRA-13627) - * Nodetool listsnapshots output is missing a newline, if there are no snapshots (CASSANDRA-13568) ++ * Fix secondary index queries on COMPACT tables (CASSANDRA-13627) + * Nodetool listsnapshots output is missing a newline, if there are no snapshots (CASSANDRA-13568) 3.11.0 http://git-wip-us.apache.org/repos/asf/cassandra/blob/977363e1/src/java/org/apache/cassandra/cql3/selection/Selection.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/selection/Selection.java index 4a636a1,4ea1071..2f833d4 --- a/src/java/org/apache/cassandra/cql3/selection/Selection.java +++ b/src/java/org/apache/cassandra/cql3/selection/Selection.java @@@ -80,7 -86,7 +80,7 @@@ public abstract class Selectio */ public boolean containsStaticColumns() { - if (!table.hasStaticColumns()) - if (cfm.isStaticCompactTable() || !cfm.hasStaticColumns()) ++ if (table.isStaticCompactTable() || !table.hasStaticColumns()) return false; if (isWildcard()) http://git-wip-us.apache.org/repos/asf/cassandra/blob/977363e1/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/SelectStatement.java index a39416b,e8b4600..2cec190 --- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java @@@ -1007,41 -966,7 +1007,41 @@@ public class SelectStatement implement prepareLimit(boundNames, limit, keyspace(), limitReceiver()), prepareLimit(boundNames, perPartitionLimit, keyspace(), perPartitionLimitReceiver())); - return new ParsedStatement.Prepared(stmt, boundNames, boundNames.getPartitionKeyBindIndexes(cfm)); + return new ParsedStatement.Prepared(stmt, boundNames, boundNames.getPartitionKeyBindIndexes(table)); + } + + /** + * Checks if the specified selectables select only partition key columns or static columns + * + * @param table the table metadata + * @param selectables the selectables to check + * @return {@code true} if the specified selectables select only partition key columns or static columns, + * {@code false} otherwise. + */ + private boolean selectOnlyStaticColumns(TableMetadata table, List<Selectable> selectables) + { - if (!table.hasStaticColumns() || selectables.isEmpty()) ++ if (table.isStaticCompactTable() || !table.hasStaticColumns() || selectables.isEmpty()) + return false; + + return Selectable.selectColumns(selectables, (column) -> column.isStatic()) + && !Selectable.selectColumns(selectables, (column) -> !column.isPartitionKey() && !column.isStatic()); + } + + /** + * Returns the columns used to order the data. + * @return the columns used to order the data. + */ + private Map<ColumnMetadata, Boolean> getOrderingColumns(TableMetadata table) + { + if (parameters.orderings.isEmpty()) + return Collections.emptyMap(); + + Map<ColumnMetadata, Boolean> orderingColumns = new LinkedHashMap<>(); + for (Map.Entry<ColumnMetadata.Raw, Boolean> entry : parameters.orderings.entrySet()) + { + orderingColumns.put(entry.getKey().prepare(table), entry.getValue()); + } + return orderingColumns; } /** http://git-wip-us.apache.org/repos/asf/cassandra/blob/977363e1/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java index 29ceb3b,bda0166..1c7576a --- a/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/entities/SecondaryIndexTest.java @@@ -1566,13 -1577,57 +1566,56 @@@ public class SecondaryIndexTest extend assertEmpty(execute("SELECT * FROM %s WHERE a = 5")); } + @Test + public void testIndicesOnCompactTable() throws Throwable + { + assertInvalidMessage("COMPACT STORAGE with composite PRIMARY KEY allows no more than one column not part of the PRIMARY KEY (got: v1, v2)", + "CREATE TABLE test (pk int, c int, v1 int, v2 int, PRIMARY KEY(pk, c)) WITH COMPACT STORAGE"); + + createTable("CREATE TABLE %s (pk int, c int, v int, PRIMARY KEY(pk, c)) WITH COMPACT STORAGE"); + assertInvalidMessage("Secondary indexes are not supported on COMPACT STORAGE tables that have clustering columns", + "CREATE INDEX ON %s(v)"); + + createTable("CREATE TABLE %s (pk int PRIMARY KEY, v int) WITH COMPACT STORAGE"); + createIndex("CREATE INDEX ON %s(v)"); + + execute("INSERT INTO %s (pk, v) VALUES (?, ?)", 1, 1); + execute("INSERT INTO %s (pk, v) VALUES (?, ?)", 2, 1); + execute("INSERT INTO %s (pk, v) VALUES (?, ?)", 3, 3); + + assertRows(execute("SELECT pk, v FROM %s WHERE v = 1"), + row(1, 1), + row(2, 1)); + + assertRows(execute("SELECT pk, v FROM %s WHERE v = 3"), + row(3, 3)); + + assertEmpty(execute("SELECT pk, v FROM %s WHERE v = 5")); + + createTable("CREATE TABLE %s (pk int PRIMARY KEY, v1 int, v2 int) WITH COMPACT STORAGE"); + createIndex("CREATE INDEX ON %s(v1)"); + + execute("INSERT INTO %s (pk, v1, v2) VALUES (?, ?, ?)", 1, 1, 1); + execute("INSERT INTO %s (pk, v1, v2) VALUES (?, ?, ?)", 2, 1, 2); + execute("INSERT INTO %s (pk, v1, v2) VALUES (?, ?, ?)", 3, 3, 3); + + assertRows(execute("SELECT pk, v2 FROM %s WHERE v1 = 1"), + row(1, 1), + row(2, 2)); + + assertRows(execute("SELECT pk, v2 FROM %s WHERE v1 = 3"), + row(3, 3)); + + assertEmpty(execute("SELECT pk, v2 FROM %s WHERE v1 = 5")); + } - - 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)); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org