You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2016/09/27 12:13:59 UTC

[3/3] cassandra git commit: Merge branch cassandra-3.0 into trunk

Merge branch cassandra-3.0 into trunk


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

Branch: refs/heads/trunk
Commit: 7bef41856f7156a32c5b0cc066b43c697a52d69d
Parents: 5777013 b7fc5dc
Author: Benjamin Lerer <b....@gmail.com>
Authored: Tue Sep 27 14:10:37 2016 +0200
Committer: Benjamin Lerer <b....@gmail.com>
Committed: Tue Sep 27 14:13:22 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/db/marshal/TupleType.java  |  7 +++-
 .../apache/cassandra/db/marshal/UserType.java   |  6 +--
 .../cassandra/serializers/ListSerializer.java   | 10 ++++-
 .../cassandra/serializers/MapSerializer.java    | 10 ++++-
 .../cassandra/serializers/SetSerializer.java    | 11 ++++-
 .../cassandra/serializers/UTF8Serializer.java   |  3 ++
 .../validation/entities/CollectionsTest.java    | 42 ++++++++++++++++++++
 .../cql3/validation/entities/TupleTypeTest.java | 10 +++++
 .../cql3/validation/entities/UserTypesTest.java | 11 +++++
 10 files changed, 104 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bef4185/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index e10b870,576dfb5..b6a687d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -86,57 -30,12 +86,58 @@@ Merged from 3.0
   * Disk failure policy should not be invoked on out of space (CASSANDRA-12385)
   * Calculate last compacted key on startup (CASSANDRA-6216)
   * Add schema to snapshot manifest, add USING TIMESTAMP clause to ALTER TABLE statements (CASSANDRA-7190)
 + * If CF has no clustering columns, any row cache is full partition cache (CASSANDRA-12499)
 +Merged from 2.2:
++ * Make Collections deserialization more robust (CASSANDRA-12618)
 + * Fix exceptions when enabling gossip on nodes that haven't joined the ring (CASSANDRA-12253)
 + * Fix authentication problem when invoking clqsh copy from a SOURCE command (CASSANDRA-12642)
 + * Decrement pending range calculator jobs counter in finally block
 + * cqlshlib tests: increase default execute timeout (CASSANDRA-12481)
 + * Forward writes to replacement node when replace_address != broadcast_address (CASSANDRA-8523)
 + * Fail repair on non-existing table (CASSANDRA-12279)
 + * Enable repair -pr and -local together (fix regression of CASSANDRA-7450) (CASSANDRA-12522)
 +
 +
 +3.8, 3.9
 + * Fix value skipping with counter columns (CASSANDRA-11726)
 + * Fix nodetool tablestats miss SSTable count (CASSANDRA-12205)
 + * Fixed flacky SSTablesIteratedTest (CASSANDRA-12282)
 + * Fixed flacky SSTableRewriterTest: check file counts before calling validateCFS (CASSANDRA-12348)
 + * cqlsh: Fix handling of $$-escaped strings (CASSANDRA-12189)
 + * Fix SSL JMX requiring truststore containing server cert (CASSANDRA-12109)
 + * RTE from new CDC column breaks in flight queries (CASSANDRA-12236)
 + * Fix hdr logging for single operation workloads (CASSANDRA-12145)
 + * Fix SASI PREFIX search in CONTAINS mode with partial terms (CASSANDRA-12073)
 + * Increase size of flushExecutor thread pool (CASSANDRA-12071)
 + * Partial revert of CASSANDRA-11971, cannot recycle buffer in SP.sendMessagesToNonlocalDC (CASSANDRA-11950)
 + * Upgrade netty to 4.0.39 (CASSANDRA-12032, CASSANDRA-12034)
 + * Improve details in compaction log message (CASSANDRA-12080)
 + * Allow unset values in CQLSSTableWriter (CASSANDRA-11911)
 + * Chunk cache to request compressor-compatible buffers if pool space is exhausted (CASSANDRA-11993)
 + * Remove DatabaseDescriptor dependencies from SequentialWriter (CASSANDRA-11579)
 + * Move skip_stop_words filter before stemming (CASSANDRA-12078)
 + * Support seek() in EncryptedFileSegmentInputStream (CASSANDRA-11957)
 + * SSTable tools mishandling LocalPartitioner (CASSANDRA-12002)
 + * When SEPWorker assigned work, set thread name to match pool (CASSANDRA-11966)
 + * Add cross-DC latency metrics (CASSANDRA-11596)
 + * Allow terms in selection clause (CASSANDRA-10783)
 + * Add bind variables to trace (CASSANDRA-11719)
 + * Switch counter shards' clock to timestamps (CASSANDRA-9811)
 + * Introduce HdrHistogram and response/service/wait separation to stress tool (CASSANDRA-11853)
 + * entry-weighers in QueryProcessor should respect partitionKeyBindIndexes field (CASSANDRA-11718)
 + * Support older ant versions (CASSANDRA-11807)
 + * Estimate compressed on disk size when deciding if sstable size limit reached (CASSANDRA-11623)
 + * cassandra-stress profiles should support case sensitive schemas (CASSANDRA-11546)
 + * Remove DatabaseDescriptor dependency from FileUtils (CASSANDRA-11578)
 + * Faster streaming (CASSANDRA-9766)
 + * Add prepared query parameter to trace for "Execute CQL3 prepared query" session (CASSANDRA-11425)
 + * Add repaired percentage metric (CASSANDRA-11503)
 + * Add Change-Data-Capture (CASSANDRA-8844)
 +Merged from 3.0:
 + * Fix paging for 2.x to 3.x upgrades (CASSANDRA-11195)
   * Fix clean interval not sent to commit log for empty memtable flush (CASSANDRA-12436)
   * Fix potential resource leak in RMIServerSocketFactoryImpl (CASSANDRA-12331)
 - * Backport CASSANDRA-12002 (CASSANDRA-12177)
   * Make sure compaction stats are updated when compaction is interrupted (CASSANDRA-12100)
 - * Fix potential bad messaging service message for paged range reads
 -   within mixed-version 3.x clusters (CASSANDRA-12249)
   * Change commitlog and sstables to track dirty and clean intervals (CASSANDRA-11828)
   * NullPointerException during compaction on table with static columns (CASSANDRA-12336)
   * Fixed ConcurrentModificationException when reading metrics in GraphiteReporter (CASSANDRA-11823)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bef4185/src/java/org/apache/cassandra/db/marshal/TupleType.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/marshal/TupleType.java
index eaf6653,5486183..24498aa
--- a/src/java/org/apache/cassandra/db/marshal/TupleType.java
+++ b/src/java/org/apache/cassandra/db/marshal/TupleType.java
@@@ -154,7 -125,7 +154,7 @@@ public class TupleType extends Abstract
              if (!input.hasRemaining())
                  return;
  
--            if (input.remaining() < 4)
++            if (input.remaining() < Integer.BYTES)
                  throw new MarshalException(String.format("Not enough bytes to read size of %dth component", i));
  
              int size = input.getInt();
@@@ -188,17 -159,8 +188,22 @@@
                  return Arrays.copyOfRange(components, 0, i);
  
              int size = input.getInt();
++
++            if (input.remaining() < size)
++                throw new MarshalException(String.format("Not enough bytes to read %dth component", i));
++
++            // size < 0 means null value
              components[i] = size < 0 ? null : ByteBufferUtil.readBytes(input, size);
          }
 +
 +        // error out if we got more values in the tuple/UDT than we expected
 +        if (input.hasRemaining())
 +        {
 +            throw new InvalidRequestException(String.format(
 +                    "Expected %s %s for %s column, but got more",
 +                    size(), size() == 1 ? "value" : "values", this.asCQL3Type()));
 +        }
 +
          return components;
      }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bef4185/src/java/org/apache/cassandra/db/marshal/UserType.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/marshal/UserType.java
index 74378b2,f11c029..a9c02f3
--- a/src/java/org/apache/cassandra/db/marshal/UserType.java
+++ b/src/java/org/apache/cassandra/db/marshal/UserType.java
@@@ -24,15 -25,11 +24,15 @@@ import java.util.stream.Collectors
  import com.google.common.base.Objects;
  
  import org.apache.cassandra.cql3.*;
 +import org.apache.cassandra.db.rows.Cell;
 +import org.apache.cassandra.db.rows.CellPath;
  import org.apache.cassandra.exceptions.ConfigurationException;
  import org.apache.cassandra.exceptions.SyntaxException;
- import org.apache.cassandra.serializers.*;
+ import org.apache.cassandra.serializers.MarshalException;
  import org.apache.cassandra.utils.ByteBufferUtil;
  import org.apache.cassandra.utils.Pair;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
  
  /**
   * A user defined type.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bef4185/src/java/org/apache/cassandra/serializers/UTF8Serializer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bef4185/test/unit/org/apache/cassandra/cql3/validation/entities/CollectionsTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7bef4185/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
index 59383c6,850d8ee..1b2f3e9
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
@@@ -48,6 -46,17 +48,17 @@@ public class UserTypesTest extends CQLT
      }
  
      @Test
+     public void testInvalidInputForUserType() throws Throwable
+     {
+         String myType = createType("CREATE TYPE %s (f int)");
+         createTable("CREATE TABLE %s(pk int PRIMARY KEY, t frozen<" + myType + ">)");
 -        assertInvalidMessage("Not enough bytes to read 0th field f",
++        assertInvalidMessage("Not enough bytes to read 0th component",
+                              "INSERT INTO %s (pk, t) VALUES (?, ?)", 1, "test");
 -        assertInvalidMessage("Not enough bytes to read 0th field f",
++        assertInvalidMessage("Not enough bytes to read 0th component",
+                              "INSERT INTO %s (pk, t) VALUES (?, ?)", 1, Long.MAX_VALUE);
+     }
+ 
+     @Test
      public void testCassandra8105() throws Throwable
      {
          String ut1 = createType("CREATE TYPE %s (a int, b int)");