Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E13B115BE for ; Mon, 18 Aug 2014 08:24:08 +0000 (UTC) Received: (qmail 78270 invoked by uid 500); 18 Aug 2014 08:24:08 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 78223 invoked by uid 500); 18 Aug 2014 08:24:08 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 78195 invoked by uid 99); 18 Aug 2014 08:24:08 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Aug 2014 08:24:08 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 268909AC863; Mon, 18 Aug 2014 08:24:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: slebresne@apache.org To: commits@cassandra.apache.org Date: Mon, 18 Aug 2014 08:24:09 -0000 Message-Id: <6d8846d4705449eab855d2a137e86674@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/5] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1.0 Merge branch 'cassandra-2.0' into cassandra-2.1.0 Conflicts: CHANGES.txt src/java/org/apache/cassandra/cql3/statements/BatchStatement.java src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e8507851 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e8507851 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e8507851 Branch: refs/heads/trunk Commit: e85078519c6dd175856b5cf5783ca177bb136d99 Parents: cb772e5 700e816 Author: Sylvain Lebresne Authored: Mon Aug 18 10:15:32 2014 +0200 Committer: Sylvain Lebresne Committed: Mon Aug 18 10:15:32 2014 +0200 ---------------------------------------------------------------------- CHANGES.txt | 7 +++++++ .../cassandra/cql3/statements/BatchStatement.java | 3 +++ .../cql3/statements/ModificationStatement.java | 18 ++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e8507851/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index eeb115f,f489702..78ef5df --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,24 -1,13 +1,31 @@@ -2.0.10 ++2.1.0 ++Merged from 2.0: + * Properly reject operations on list index with conditions (CASSANDRA-7499) + * (Hadoop) allow ACFRW to limit nodes to local DC (CASSANDRA-7252) ++ ++ +2.1.0-rc6 + * Fix OOM issue from netty caching over time (CASSANDRA-7743) + * json2sstable couldn't import JSON for CQL table (CASSANDRA-7477) + * Invalidate all caches on table drop (CASSANDRA-7561) + * Skip strict endpoint selection for ranges if RF == nodes (CASSANRA-7765) + * Fix Thrift range filtering without 2ary index lookups (CASSANDRA-7741) + * Add tracing entries about concurrent range requests (CASSANDRA-7599) + * (cqlsh) Fix DESCRIBE for NTS keyspaces (CASSANDRA-7729) + * Remove netty buffer ref-counting (CASSANDRA-7735) + * Pass mutated cf to index updater for use by PRSI (CASSANDRA-7742) + * Include stress yaml example in release and deb (CASSANDRA-7717) + * workaround for netty issue causing corrupted data off the wire (CASSANDRA-7695) + * cqlsh DESC CLUSTER fails retrieving ring information (CASSANDRA-7687) + * Fix binding null values inside UDT (CASSANDRA-7685) + * Fix UDT field selection with empty fields (CASSANDRA-7670) + * Bogus deserialization of static cells from sstable (CASSANDRA-7684) + * Fix NPE on compaction leftover cleanup for dropped table (CASSANDRA-7770) +Merged from 2.0: + * (cqlsh) Wait up to 10 sec for a tracing session (CASSANDRA-7222) * Fix NPE in FileCacheService.sizeInBytes (CASSANDRA-7756) - * (cqlsh) cqlsh should automatically disable tracing when selecting - from system_traces (CASSANDRA-7641) - * (Hadoop) Add CqlOutputFormat (CASSANDRA-6927) - * Don't depend on cassandra config for nodetool ring (CASSANDRA-7508) - * (cqlsh) Fix failing cqlsh formatting tests (CASSANDRA-7703) + * Remove duplicates from StorageService.getJoiningNodes (CASSANDRA-7478) + * Clone token map outside of hot gossip loops (CASSANDRA-7758) * Fix MS expiring map timeout for Paxos messages (CASSANDRA-7752) * Do not flush on truncate if durable_writes is false (CASSANDRA-7750) * Give CRR a default input_cql Statement (CASSANDRA-7226) http://git-wip-us.apache.org/repos/asf/cassandra/blob/e8507851/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/BatchStatement.java index 88d23ca,cbe3016..90be914 --- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java @@@ -124,32 -124,10 +124,35 @@@ public class BatchStatement implements if (timestampSet && statement.isTimestampSet()) throw new InvalidRequestException("Timestamp must be set either on BATCH or individual statements"); - statement.validate(state); + if (type == Type.COUNTER && !statement.isCounter()) + throw new InvalidRequestException("Cannot include non-counter statement in a counter batch"); + + if (type == Type.LOGGED && statement.isCounter()) + throw new InvalidRequestException("Cannot include a counter statement in a logged batch"); + + if (statement.isCounter()) + hasCounters = true; + else + hasNonCounters = true; + } + + if (hasCounters && hasNonCounters) + throw new InvalidRequestException("Counter and non-counter mutations cannot exist in the same batch"); - if (hasConditions && statement.requiresRead()) - throw new InvalidRequestException("Operations using list indexes are not allowed with IF conditions"); + if (hasConditions) + { + String ksName = null; + String cfName = null; + for (ModificationStatement stmt : statements) + { + if (ksName != null && (!stmt.keyspace().equals(ksName) || !stmt.columnFamily().equals(cfName))) + throw new InvalidRequestException("Batch with conditions cannot span multiple tables"); + ksName = stmt.keyspace(); + cfName = stmt.columnFamily(); ++ ++ if (stmt.requiresRead()) ++ throw new InvalidRequestException("Operations using list indexes are not allowed with IF conditions"); + } } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/e8507851/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java index 478f596,99dd9d9..fef0e94 --- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java @@@ -147,14 -151,33 +147,20 @@@ public abstract class ModificationState public void validate(ClientState state) throws InvalidRequestException { - if (hasConditions() && attrs.isTimestampSet()) - throw new InvalidRequestException("Cannot provide custom timestamp for conditional updates"); + if (hasConditions()) + { + if (attrs.isTimestampSet()) - throw new InvalidRequestException("Cannot provide custom timestamp for conditional update"); ++ throw new InvalidRequestException("Cannot provide custom timestamp for conditional updates"); + + if (requiresRead()) + throw new InvalidRequestException("Operations using list indexes are not allowed with IF conditions"); + } - if (isCounter()) - { - if (attrs.isTimestampSet() && !loggedCounterTimestamp) - { - logger.warn("Detected use of 'USING TIMESTAMP' in a counter UPDATE. This is invalid " + - "because counters do not use timestamps, and the timestamp has been ignored. " + - "Such queries will be rejected in Cassandra 2.1+ - please fix your queries before then."); - loggedCounterTimestamp = true; - } + if (isCounter() && attrs.isTimestampSet()) + throw new InvalidRequestException("Cannot provide custom timestamp for counter updates"); - if (attrs.isTimeToLiveSet() && !loggedCounterTTL) - { - logger.warn("Detected use of 'USING TTL' in a counter UPDATE. This is invalid " + - "because counter tables do not support TTL, and the TTL value has been ignored. " + - "Such queries will be rejected in Cassandra 2.1+ - please fix your queries before then."); - loggedCounterTTL = true; - } - } + if (isCounter() && attrs.isTimeToLiveSet()) + throw new InvalidRequestException("Cannot provide custom TTL for counter updates"); } public void addOperation(Operation op) @@@ -406,7 -445,15 +412,15 @@@ return null; } + public boolean requiresRead() + { + for (Operation op : columnOperations) + if (op.requiresRead()) + return true; + return false; + } + - protected Map readRequiredRows(Collection partitionKeys, ColumnNameBuilder clusteringPrefix, boolean local, ConsistencyLevel cl) + protected Map readRequiredRows(Collection partitionKeys, Composite clusteringPrefix, boolean local, ConsistencyLevel cl) throws RequestExecutionException, RequestValidationException { // Lists SET operation incurs a read.