cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [4/6] git commit: Validate statements inside batch
Date Wed, 07 May 2014 09:08:43 GMT
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 <sylvain@datastax.com>
Authored: Wed May 7 10:53:09 2014 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
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.


Mime
View raw message