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 EB30211B5E for ; Wed, 14 May 2014 20:51:37 +0000 (UTC) Received: (qmail 32956 invoked by uid 500); 10 May 2014 22:00:24 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 3869 invoked by uid 500); 10 May 2014 21:58:25 -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 59945 invoked by uid 99); 10 May 2014 21:56:17 -0000 Received: from Unknown (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 May 2014 21:56:17 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B8FA19375F2; Wed, 7 May 2014 09:08:40 +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: Wed, 07 May 2014 09:08:43 -0000 Message-Id: <2acc51d5a77e4521a8ac006cb402b998@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/6] git commit: Validate statements inside batch Validate statements inside batch Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2e61cd5e Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2e61cd5e Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2e61cd5e Branch: refs/heads/trunk Commit: 2e61cd5e07f3983d262ec6bba2aea329e28c5fdc Parents: 19ff193 Author: Sylvain Lebresne Authored: Wed May 7 10:53:09 2014 +0200 Committer: Sylvain Lebresne Committed: Wed May 7 10:53:09 2014 +0200 ---------------------------------------------------------------------- .../org/apache/cassandra/cql3/statements/BatchStatement.java | 2 ++ .../apache/cassandra/cql3/statements/ModificationStatement.java | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/2e61cd5e/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java index c03548b..6a1201b 100644 --- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java @@ -128,6 +128,8 @@ public class BatchStatement implements CQLStatement, MeasurableForPreparedCache { if (timestampSet && statement.isTimestampSet()) throw new InvalidRequestException("Timestamp must be set either on BATCH or individual statements"); + + statement.validate(state); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/2e61cd5e/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java index 526a26c..f8c4042 100644 --- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java @@ -155,7 +155,7 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF public void validate(ClientState state) throws InvalidRequestException { if (hasConditions() && attrs.isTimestampSet()) - throw new InvalidRequestException("Custom timestamps are not allowed when conditions are used"); + throw new InvalidRequestException("Cannot provide custom timestamp for conditional update"); if (isCounter()) { @@ -765,9 +765,6 @@ public abstract class ModificationStatement implements CQLStatement, MeasurableF if (stmt.isCounter()) throw new InvalidRequestException("Conditional updates are not supported on counter tables"); - if (attrs.timestamp != null) - throw new InvalidRequestException("Cannot provide custom timestamp for conditional update"); - if (ifNotExists) { // To have both 'IF NOT EXISTS' and some other conditions doesn't make sense.