cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [2/3] cassandra git commit: Early validation of partition keys in CAS requests
Date Fri, 18 Sep 2015 16:20:06 GMT
Early validation of partition keys in CAS requests

Patch by Sam Tunnicliffe; reviewed by Benjamin Lerer for CASSANDRA-10338


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6e805cae
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6e805cae
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6e805cae

Branch: refs/heads/trunk
Commit: 6e805caed9be650cbd12bc0afd5d564f6fe5185a
Parents: fa800fc
Author: Sam Tunnicliffe <sam@beobal.com>
Authored: Tue Sep 15 11:14:10 2015 +0100
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Fri Sep 18 17:17:27 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                    | 1 +
 .../cassandra/cql3/statements/ModificationStatement.java       | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6e805cae/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 248192e..775d8a4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.0-rc1
+ * Check partition keys for CAS operations during stmt validation (CASSANDRA-10338)
  * Add custom query expressions to SELECT (CASSANDRA-10217)
  * Fix minor bugs in MV handling (CASSANDRA-10362)
  * Allow custom indexes with 0,1 or multiple target columns (CASSANDRA-10124)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6e805cae/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 3f3f3f5..54a4f28 100644
--- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
@@ -281,7 +281,11 @@ public abstract class ModificationStatement implements CQLStatement
     public List<ByteBuffer> buildPartitionKeyNames(QueryOptions options)
     throws InvalidRequestException
     {
-        return restrictions.getPartitionKeys(options);
+        List<ByteBuffer> partitionKeys = restrictions.getPartitionKeys(options);
+        for (ByteBuffer key : partitionKeys)
+            QueryProcessor.validateKey(key);
+
+        return partitionKeys;
     }
 
     public NavigableSet<Clustering> createClustering(QueryOptions options)


Mime
View raw message