Merge branch 'cassandra-2.0' into cassandra-2.1 Conflicts: CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f4037edb Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f4037edb Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f4037edb Branch: refs/heads/cassandra-2.1 Commit: f4037edbfb1e471f104e836e96f61619ae030d42 Parents: 24e4210 29a8b88 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Fri Oct 17 11:54:43 2014 +0200 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Fri Oct 17 11:54:43 2014 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cql3/statements/DeleteStatement.java | 19 +++++++++++++++++++ .../cql3/statements/ModificationStatement.java | 14 +++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4037edb/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 942236c,544cf9a..7cd5154 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,89 -1,5 +1,90 @@@ -2.0.11: +2.1.1 + * Fix IllegalArgumentException when a list of IN values containing tuples + is passed as a single arg to a prepared statement with the v1 or v2 + protocol (CASSANDRA-8062) + * Fix ClassCastException in DISTINCT query on static columns with + query paging (CASSANDRA-8108) + * Fix NPE on null nested UDT inside a set (CASSANDRA-8105) + * Fix exception when querying secondary index on set items or map keys + when some clustering columns are specified (CASSANDRA-8073) + * Send proper error response when there is an error during native + protocol message decode (CASSANDRA-8118) + * Gossip should ignore generation numbers too far in the future (CASSANDRA-8113) + * Fix NPE when creating a table with frozen sets, lists (CASSANDRA-8104) + * Fix high memory use due to tracking reads on incrementally opened sstable + readers (CASSANDRA-8066) + * Fix EXECUTE request with skipMetadata=false returning no metadata + (CASSANDRA-8054) + * Allow concurrent use of CQLBulkOutputFormat (CASSANDRA-7776) + * Shutdown JVM on OOM (CASSANDRA-7507) + * Upgrade netty version and enable epoll event loop (CASSANDRA-7761) + * Don't duplicate sstables smaller than split size when using + the sstablesplitter tool (CASSANDRA-7616) + * Avoid re-parsing already prepared statements (CASSANDRA-7923) + * Fix some Thrift slice deletions and updates of COMPACT STORAGE + tables with some clustering columns omitted (CASSANDRA-7990) + * Fix filtering for CONTAINS on sets (CASSANDRA-8033) + * Properly track added size (CASSANDRA-7239) + * Allow compilation in java 8 (CASSANDRA-7208) + * Fix Assertion error on RangeTombstoneList diff (CASSANDRA-8013) + * Release references to overlapping sstables during compaction (CASSANDRA-7819) + * Send notification when opening compaction results early (CASSANDRA-8034) + * Make native server start block until properly bound (CASSANDRA-7885) + * (cqlsh) Fix IPv6 support (CASSANDRA-7988) + * Ignore fat clients when checking for endpoint collision (CASSANDRA-7939) + * Make sstablerepairedset take a list of files (CASSANDRA-7995) + * (cqlsh) Tab completeion for indexes on map keys (CASSANDRA-7972) + * (cqlsh) Fix UDT field selection in select clause (CASSANDRA-7891) + * Fix resource leak in event of corrupt sstable + * (cqlsh) Add command line option for cqlshrc file path (CASSANDRA-7131) + * Provide visibility into prepared statements churn (CASSANDRA-7921, CASSANDRA-7930) + * Invalidate prepared statements when their keyspace or table is + dropped (CASSANDRA-7566) + * cassandra-stress: fix support for NetworkTopologyStrategy (CASSANDRA-7945) + * Fix saving caches when a table is dropped (CASSANDRA-7784) + * Add better error checking of new stress profile (CASSANDRA-7716) + * Use ThreadLocalRandom and remove FBUtilities.threadLocalRandom (CASSANDRA-7934) + * Prevent operator mistakes due to simultaneous bootstrap (CASSANDRA-7069) + * cassandra-stress supports whitelist mode for node config (CASSANDRA-7658) + * GCInspector more closely tracks GC; cassandra-stress and nodetool report it (CASSANDRA-7916) + * nodetool won't output bogus ownership info without a keyspace (CASSANDRA-7173) + * Add human readable option to nodetool commands (CASSANDRA-5433) + * Don't try to set repairedAt on old sstables (CASSANDRA-7913) + * Add metrics for tracking PreparedStatement use (CASSANDRA-7719) + * (cqlsh) tab-completion for triggers (CASSANDRA-7824) + * (cqlsh) Support for query paging (CASSANDRA-7514) + * (cqlsh) Show progress of COPY operations (CASSANDRA-7789) + * Add syntax to remove multiple elements from a map (CASSANDRA-6599) + * Support non-equals conditions in lightweight transactions (CASSANDRA-6839) + * Add IF [NOT] EXISTS to create/drop triggers (CASSANDRA-7606) + * (cqlsh) Display the current logged-in user (CASSANDRA-7785) + * (cqlsh) Don't ignore CTRL-C during COPY FROM execution (CASSANDRA-7815) + * (cqlsh) Order UDTs according to cross-type dependencies in DESCRIBE + output (CASSANDRA-7659) + * (cqlsh) Fix handling of CAS statement results (CASSANDRA-7671) + * (cqlsh) COPY TO/FROM improvements (CASSANDRA-7405) + * Support list index operations with conditions (CASSANDRA-7499) + * Add max live/tombstoned cells to nodetool cfstats output (CASSANDRA-7731) + * Validate IPv6 wildcard addresses properly (CASSANDRA-7680) + * (cqlsh) Error when tracing query (CASSANDRA-7613) + * Avoid IOOBE when building SyntaxError message snippet (CASSANDRA-7569) + * SSTableExport uses correct validator to create string representation of partition + keys (CASSANDRA-7498) + * Avoid NPEs when receiving type changes for an unknown keyspace (CASSANDRA-7689) + * Add support for custom 2i validation (CASSANDRA-7575) + * Pig support for hadoop CqlInputFormat (CASSANDRA-6454) + * Add listen_interface and rpc_interface options (CASSANDRA-7417) + * Improve schema merge performance (CASSANDRA-7444) + * Adjust MT depth based on # of partition validating (CASSANDRA-5263) + * Optimise NativeCell comparisons (CASSANDRA-6755) + * Configurable client timeout for cqlsh (CASSANDRA-7516) + * Include snippet of CQL query near syntax error in messages (CASSANDRA-7111) + * Make repair -pr work with -local (CASSANDRA-7450) + * Fix error in sstableloader with -cph > 1 (CASSANDRA-8007) + * Fix snapshot repair error on indexed tables (CASSANDRA-8020) + * Do not exit nodetool repair when receiving JMX NOTIF_LOST (CASSANDRA-7909) +Merged from 2.0: + * Reject conditions on DELETE unless full PK is given (CASSANDRA-6430) * Properly reject the token function DELETE (CASSANDRA-7747) * Force batchlog replay before decommissioning a node (CASSANDRA-7446) * Fix hint replay with many accumulated expired hints (CASSANDRA-6998) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4037edb/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java index 49fdfc2,6c1c6ed..93dd8c5 --- a/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/DeleteStatement.java @@@ -20,11 -20,11 +20,13 @@@ package org.apache.cassandra.cql3.state import java.nio.ByteBuffer; import java.util.*; + import com.google.common.collect.Iterators; + import org.apache.cassandra.cql3.*; import org.apache.cassandra.config.CFMetaData; +import org.apache.cassandra.config.ColumnDefinition; import org.apache.cassandra.db.*; +import org.apache.cassandra.db.composites.Composite; import org.apache.cassandra.exceptions.*; import org.apache.cassandra.utils.Pair; @@@ -74,16 -79,38 +76,33 @@@ public class DeleteStatement extends Mo } else { - // Delete specific columns - if (cfDef.isCompact) - { - ByteBuffer columnName = builder.build(); - cf.addColumn(params.makeTombstone(columnName)); - } - else - { - for (Operation deletion : deletions) - deletion.execute(key, cf, builder.copy(), params); - } + cf.addAtom(params.makeRangeTombstone(prefix.slice())); } } + else + { + for (Operation op : deletions) + op.execute(key, cf, prefix, params); + } } + protected void validateWhereClauseForConditions() throws InvalidRequestException + { - Iterator<CFDefinition.Name> iterator = Iterators.concat(cfm.getCfDef().partitionKeys().iterator(), cfm.getCfDef().clusteringColumns().iterator()); ++ Iterator<ColumnDefinition> iterator = Iterators.concat(cfm.partitionKeyColumns().iterator(), cfm.clusteringColumns().iterator()); + while (iterator.hasNext()) + { - CFDefinition.Name name = iterator.next(); - Restriction restriction = processedKeys.get(name.name); ++ ColumnDefinition def = iterator.next(); ++ Restriction restriction = processedKeys.get(def.name); + if (restriction == null || !(restriction.isEQ() || restriction.isIN())) + { + throw new InvalidRequestException( + String.format("DELETE statements must restrict all PRIMARY KEY columns with equality relations in order " + - "to use IF conditions, but column '%s' is not restricted", name.name)); ++ "to use IF conditions, but column '%s' is not restricted", def.name)); + } + } + + } + public static class Parsed extends ModificationStatement.Parsed { private final List<Operation.RawDeletion> deletions; http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4037edb/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java index c256a6c,adb0084..b8cb818 --- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java @@@ -58,9 -62,10 +58,9 @@@ public abstract class ModificationState public final CFMetaData cfm; public final Attributes attrs; - private final Map<ColumnIdentifier, Restriction> processedKeys = new HashMap<ColumnIdentifier, Restriction>(); + protected final Map<ColumnIdentifier, Restriction> processedKeys = new HashMap<>(); private final List<Operation> columnOperations = new ArrayList<Operation>(); - private int boundTerms; // Separating normal and static conditions makes things somewhat easier private List<ColumnCondition> columnConditions; private List<ColumnCondition> staticConditions; @@@ -678,10 -743,20 +678,20 @@@ throws RequestExecutionException, RequestValidationException { // Some lists operation requires reading - Map<ByteBuffer, ColumnGroupMap> rows = readRequiredRows(keys, prefix, local, cl); - return new UpdateParameters(cfm, variables, getTimestamp(now, variables), getTimeToLive(variables), rows); + Map<ByteBuffer, CQL3Row> rows = readRequiredRows(keys, prefix, local, options.getConsistency()); + return new UpdateParameters(cfm, options, getTimestamp(now, options), getTimeToLive(options), rows); } + /** + * If there are conditions on the statement, this is called after the where clause and conditions have been + * processed to check that they are compatible. + * @throws InvalidRequestException + */ + protected void validateWhereClauseForConditions() throws InvalidRequestException + { + // no-op by default + } + public static abstract class Parsed extends CFStatement { protected final Attributes.Raw attrs; @@@ -758,7 -837,11 +768,9 @@@ } } } + + stmt.validateWhereClauseForConditions(); } - - stmt.boundTerms = boundNames.getCollectedCount() - collected; return stmt; }