You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2013/11/28 09:13:46 UTC

[1/2] git commit: Throw IRE if a prepared query has more markers than supported

Updated Branches:
  refs/heads/cassandra-2.0 28658ddb2 -> 43e61e8af


Throw IRE if a prepared query has more markers than supported

patch by lyubent; reviewed by slebresne for CASSANDRA-5598


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

Branch: refs/heads/cassandra-2.0
Commit: a322b645e6725fae4b4b765ff1b6e6375efe24d5
Parents: 4bdd7f8
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Thu Nov 28 09:07:45 2013 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Thu Nov 28 09:07:45 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                            | 1 +
 src/java/org/apache/cassandra/cql3/QueryProcessor.java | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a322b645/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0c7bb29..f84ffec 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@
  * Don't list CQL3 table in CLI describe even if named explicitely (CASSANDRA-5750)
  * cqlsh: quote single quotes in strings inside collections (CASSANDRA-6172)
  * Improve gossip performance for typical messages (CASSANDRA-6409)
+ * Throw IRE if a prepared has more markers than supported (CASSANDRA-5598)
 
 
 1.2.12

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a322b645/src/java/org/apache/cassandra/cql3/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/QueryProcessor.java b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
index 40b9339..a62b248 100644
--- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
@@ -220,7 +220,10 @@ public class QueryProcessor
         ParsedStatement.Prepared prepared = getStatement(queryString, clientState);
         ResultMessage.Prepared msg = storePreparedStatement(queryString, clientState.getRawKeyspace(), prepared, forThrift);
 
-        assert prepared.statement.getBoundsTerms() == prepared.boundNames.size();
+        int bountTerms = prepared.statement.getBoundsTerms();
+        if (bountTerms > FBUtilities.MAX_UNSIGNED_SHORT)
+            throw new InvalidRequestException(String.format("Too many markers(?). %d markers exceed the allowed maximum of %d", bountTerms, FBUtilities.MAX_UNSIGNED_SHORT));
+        assert bountTerms == prepared.boundNames.size();
         return msg;
     }
 


[2/2] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0

Posted by sl...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0

Conflicts:
	src/java/org/apache/cassandra/cql3/QueryProcessor.java


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

Branch: refs/heads/cassandra-2.0
Commit: 43e61e8af704b3353c354629254fb7c16e6a218a
Parents: 28658dd a322b64
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Thu Nov 28 09:10:16 2013 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Thu Nov 28 09:10:16 2013 +0100

----------------------------------------------------------------------
 CHANGES.txt                                            | 1 +
 src/java/org/apache/cassandra/cql3/QueryProcessor.java | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/43e61e8a/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 2bafb90,f84ffec..bd8dd1c
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,49 -1,14 +1,50 @@@
 -1.2.13
 +2.0.4
 + * Fix divide-by-zero in PCI (CASSANDRA-6403)
 + * Fix setting last compacted key in the wrong level for LCS (CASSANDRA-6284)
 + * Add sub-ms precision formats to the timestamp parser (CASSANDRA-6395)
 +Merged from 1.2:
   * Fix thundering herd on endpoint cache invalidation (CASSANDRA-6345)
 - * Optimize FD phi calculation (CASSANDRA-6386)
 - * Improve initial FD phi estimate when starting up (CASSANDRA-6385)
 - * Don't list CQL3 table in CLI describe even if named explicitely (CASSANDRA-5750)
   * cqlsh: quote single quotes in strings inside collections (CASSANDRA-6172)
   * Improve gossip performance for typical messages (CASSANDRA-6409)
+  * Throw IRE if a prepared has more markers than supported (CASSANDRA-5598)
  
  
 -1.2.12
 +2.0.3
 + * Fix FD leak on slice read path (CASSANDRA-6275)
 + * Cancel read meter task when closing SSTR (CASSANDRA-6358)
 + * free off-heap IndexSummary during bulk (CASSANDRA-6359)
 + * Recover from IOException in accept() thread (CASSANDRA-6349)
 + * Improve Gossip tolerance of abnormally slow tasks (CASSANDRA-6338)
 + * Fix trying to hint timed out counter writes (CASSANDRA-6322)
 + * Allow restoring specific columnfamilies from archived CL (CASSANDRA-4809)
 + * Avoid flushing compaction_history after each operation (CASSANDRA-6287)
 + * Fix repair assertion error when tombstones expire (CASSANDRA-6277)
 + * Skip loading corrupt key cache (CASSANDRA-6260)
 + * Fixes for compacting larger-than-memory rows (CASSANDRA-6274)
 + * Compact hottest sstables first and optionally omit coldest from
 +   compaction entirely (CASSANDRA-6109)
 + * Fix modifying column_metadata from thrift (CASSANDRA-6182)
 + * cqlsh: fix LIST USERS output (CASSANDRA-6242)
 + * Add IRequestSink interface (CASSANDRA-6248)
 + * Update memtable size while flushing (CASSANDRA-6249)
 + * Provide hooks around CQL2/CQL3 statement execution (CASSANDRA-6252)
 + * Require Permission.SELECT for CAS updates (CASSANDRA-6247)
 + * New CQL-aware SSTableWriter (CASSANDRA-5894)
 + * Reject CAS operation when the protocol v1 is used (CASSANDRA-6270)
 + * Correctly throw error when frame too large (CASSANDRA-5981)
 + * Fix serialization bug in PagedRange with 2ndary indexes (CASSANDRA-6299)
 + * Fix CQL3 table validation in Thrift (CASSANDRA-6140)
 + * Fix bug missing results with IN clauses (CASSANDRA-6327)
 + * Fix paging with reversed slices (CASSANDRA-6343)
 + * Set minTimestamp correctly to be able to drop expired sstables (CASSANDRA-6337)
 + * Support NaN and Infinity as float literals (CASSANDRA-6003)
 + * Remove RF from nodetool ring output (CASSANDRA-6289)
 + * Fix attempting to flush empty rows (CASSANDRA-6374)
 + * Fix potential out of bounds exception when paging (CASSANDRA-6333)
 +Merged from 1.2:
 + * Optimize FD phi calculation (CASSANDRA-6386)
 + * Improve initial FD phi estimate when starting up (CASSANDRA-6385)
 + * Don't list CQL3 table in CLI describe even if named explicitely (CASSANDRA-5750)
   * Invalidate row cache when dropping CF (CASSANDRA-6351)
   * add non-jamm path for cached statements (CASSANDRA-6293)
   * (Hadoop) Require CFRR batchSize to be at least 2 (CASSANDRA-6114)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/43e61e8a/src/java/org/apache/cassandra/cql3/QueryProcessor.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/QueryProcessor.java
index 2a18230,a62b248..335da4b
--- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
@@@ -286,16 -218,12 +286,20 @@@ public class QueryProcesso
      throws RequestValidationException
      {
          ParsedStatement.Prepared prepared = getStatement(queryString, clientState);
 -        ResultMessage.Prepared msg = storePreparedStatement(queryString, clientState.getRawKeyspace(), prepared, forThrift);
 -
+         int bountTerms = prepared.statement.getBoundsTerms();
+         if (bountTerms > FBUtilities.MAX_UNSIGNED_SHORT)
+             throw new InvalidRequestException(String.format("Too many markers(?). %d markers exceed the allowed maximum of %d", bountTerms, FBUtilities.MAX_UNSIGNED_SHORT));
+         assert bountTerms == prepared.boundNames.size();
++
 +        ResultMessage.Prepared msg = storePreparedStatement(queryString, clientState.getRawKeyspace(), prepared, forThrift);
 +
 +        if (!postPreparationHooks.isEmpty())
 +        {
 +            PreparationContext context = new PreparationContext(clientState, queryString, prepared.boundNames);
 +            for (PostPreparationHook hook : postPreparationHooks)
 +                hook.processStatement(prepared.statement, context);
 +        }
 +
-         assert prepared.statement.getBoundsTerms() == prepared.boundNames.size();
          return msg;
      }