Merge branch cassandra-2.2 into cassandra-3.0
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e51c85f2 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e51c85f2 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e51c85f2 Branch: refs/heads/cassandra-3.11 Commit: e51c85f2e6045e077dad8575f7737d502fd50414 Parents: af20226 b77e11c Author: Benjamin Lerer <b.le...@gmail.com> Authored: Fri Jul 7 13:31:08 2017 +0200 Committer: Benjamin Lerer <b.le...@gmail.com> Committed: Fri Jul 7 13:34:32 2017 +0200 ---------------------------------------------------------------------- CHANGES.txt | 3 +- .../org/apache/cassandra/cql3/UserTypes.java | 4 +- .../apache/cassandra/db/marshal/TupleType.java | 45 ++++--------- .../apache/cassandra/db/marshal/UserType.java | 50 +++++---------- .../cassandra/serializers/TupleSerializer.java | 66 +++++++++++++++++++ .../serializers/UserTypeSerializer.java | 67 ++++++++++++++++++++ .../validation/entities/CollectionsTest.java | 36 +++++++++++ .../cql3/validation/entities/TupleTypeTest.java | 10 ++- .../cql3/validation/entities/UserTypesTest.java | 9 +++ 9 files changed, 220 insertions(+), 70 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e51c85f2/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 52b0027,08c6e48..c98ffd9 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,60 -1,15 +1,61 @@@ -2.2.11 - * Fix nested Tuples/UDTs validation (CASSANDRA-13646) - * Remove unused max_value_size_in_mb config setting from yaml (CASSANDRA-13625 +3.0.15 + * Allow different NUMACTL_ARGS to be passed in (CASSANDRA-13557) + * Allow native function calls in CQLSSTableWriter (CASSANDRA-12606) + * Fix secondary index queries on COMPACT tables (CASSANDRA-13627) + * Nodetool listsnapshots output is missing a newline, if there are no snapshots (CASSANDRA-13568) - ++ Merged from 2.2: ++* Fix nested Tuples/UDTs validation (CASSANDRA-13646) - -2.2.10 +3.0.14 + * Ensure int overflow doesn't occur when calculating large partition warning size (CASSANDRA-13172) + * Ensure consistent view of partition columns between coordinator and replica in ColumnFilter (CASSANDRA-13004) + * Failed unregistering mbean during drop keyspace (CASSANDRA-13346) + * nodetool scrub/cleanup/upgradesstables exit code is wrong (CASSANDRA-13542) + * Fix the reported number of sstable data files accessed per read (CASSANDRA-13120) + * Fix schema digest mismatch during rolling upgrades from versions before 3.0.12 (CASSANDRA-13559) + * Upgrade JNA version to 4.4.0 (CASSANDRA-13072) + * Interned ColumnIdentifiers should use minimal ByteBuffers (CASSANDRA-13533) + * ReverseIndexedReader may drop rows during 2.1 to 3.0 upgrade (CASSANDRA-13525) + * Fix repair process violating start/end token limits for small ranges (CASSANDRA-13052) + * Add storage port options to sstableloader (CASSANDRA-13518) + * Properly handle quoted index names in cqlsh DESCRIBE output (CASSANDRA-12847) + * Avoid reading static row twice from old format sstables (CASSANDRA-13236) + * Fix NPE in StorageService.excise() (CASSANDRA-13163) + * Expire OutboundTcpConnection messages by a single Thread (CASSANDRA-13265) + * Fail repair if insufficient responses received (CASSANDRA-13397) + * Fix SSTableLoader fail when the loaded table contains dropped columns (CASSANDRA-13276) + * Avoid name clashes in CassandraIndexTest (CASSANDRA-13427) + * Handling partially written hint files (CASSANDRA-12728) + * Interrupt replaying hints on decommission (CASSANDRA-13308) + * Fix schema version calculation for rolling upgrades (CASSANDRA-13441) +Merged from 2.2: * Nodes started with join_ring=False should be able to serve requests when authentication is enabled (CASSANDRA-11381) * cqlsh COPY FROM: increment error count only for failures, not for attempts (CASSANDRA-13209) - * nodetool upgradesstables should upgrade system tables (CASSANDRA-13119) + +3.0.13 + * Make reading of range tombstones more reliable (CASSANDRA-12811) + * Fix startup problems due to schema tables not completely flushed (CASSANDRA-12213) + * Fix view builder bug that can filter out data on restart (CASSANDRA-13405) + * Fix 2i page size calculation when there are no regular columns (CASSANDRA-13400) + * Fix the conversion of 2.X expired rows without regular column data (CASSANDRA-13395) + * Fix hint delivery when using ext+internal IPs with prefer_local enabled (CASSANDRA-13020) + * Fix possible NPE on upgrade to 3.0/3.X in case of IO errors (CASSANDRA-13389) + * Legacy deserializer can create empty range tombstones (CASSANDRA-13341) + * Use the Kernel32 library to retrieve the PID on Windows and fix startup checks (CASSANDRA-13333) + * Fix code to not exchange schema across major versions (CASSANDRA-13274) + * Dropping column results in "corrupt" SSTable (CASSANDRA-13337) + * Bugs handling range tombstones in the sstable iterators (CASSANDRA-13340) + * Fix CONTAINS filtering for null collections (CASSANDRA-13246) + * Applying: Use a unique metric reservoir per test run when using Cassandra-wide metrics residing in MBeans (CASSANDRA-13216) + * Propagate row deletions in 2i tables on upgrade (CASSANDRA-13320) + * Slice.isEmpty() returns false for some empty slices (CASSANDRA-13305) + * Add formatted row output to assertEmpty in CQL Tester (CASSANDRA-13238) + * Legacy caching options can prevent 3.0 upgrade (CASSANDRA-13384) + * Nodetool upgradesstables/scrub/compact ignores system tables (CASSANDRA-13410) + * Fix NPE issue in StorageService (CASSANDRA-13060) +Merged from 2.2: * Avoid starting gossiper in RemoveTest (CASSANDRA-13407) * Fix weightedSize() for row-cache reported by JMX and NodeTool (CASSANDRA-13393) - * Fix JVM metric paths (CASSANDRA-13103) * Honor truststore-password parameter in cassandra-stress (CASSANDRA-12773) * Discard in-flight shadow round responses (CASSANDRA-12653) * Don't anti-compact repaired data to avoid inconsistencies (CASSANDRA-13153) http://git-wip-us.apache.org/repos/asf/cassandra/blob/e51c85f2/src/java/org/apache/cassandra/cql3/UserTypes.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e51c85f2/src/java/org/apache/cassandra/db/marshal/TupleType.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/marshal/TupleType.java index 5486183,bf7eae4..3af1054 --- a/src/java/org/apache/cassandra/db/marshal/TupleType.java +++ b/src/java/org/apache/cassandra/db/marshal/TupleType.java @@@ -39,9 -39,10 +39,11 @@@ public class TupleType extends Abstract { protected final List<AbstractType<?>> types; + private final TupleSerializer serializer; + public TupleType(List<AbstractType<?>> types) { + super(ComparisonType.CUSTOM); for (int i = 0; i < types.size(); i++) types.set(i, types.get(i).freeze()); this.types = types; http://git-wip-us.apache.org/repos/asf/cassandra/blob/e51c85f2/src/java/org/apache/cassandra/db/marshal/UserType.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e51c85f2/test/unit/org/apache/cassandra/cql3/validation/entities/CollectionsTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/cql3/validation/entities/CollectionsTest.java index e5cb480,69d5a5c..c00d707 --- a/test/unit/org/apache/cassandra/cql3/validation/entities/CollectionsTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/entities/CollectionsTest.java @@@ -1006,4 -748,40 +1006,40 @@@ public class CollectionsTest extends CQ execute("UPDATE %s SET s = s - ? , s = s + ? WHERE pk = ?", set(3), set(3, 4), 1); assertRows(execute("SELECT * FROM %s WHERE pk = 1") , row(1, set(0, 1, 2, 4))); } + + @Test + public void testInsertingCollectionsWithInvalidElements() throws Throwable + { + createTable("CREATE TABLE %s (k int PRIMARY KEY, s frozen<set<tuple<int, text, double>>>)"); + assertInvalidMessage("Invalid remaining data after end of tuple value", + "INSERT INTO %s (k, s) VALUES (0, ?)", + set(tuple(1, "1", 1.0, 1), tuple(2, "2", 2.0, 2))); + - assertInvalidMessage("Invalid set literal for s: value (1, '1', 1.0, 1) is not of type tuple<int, text, double>", ++ assertInvalidMessage("Invalid set literal for s: value (1, '1', 1.0, 1) is not of type frozen<tuple<int, text, double>>", + "INSERT INTO %s (k, s) VALUES (0, {(1, '1', 1.0, 1)})"); + + createTable("CREATE TABLE %s (k int PRIMARY KEY, l frozen<list<tuple<int, text, double>>>)"); + assertInvalidMessage("Invalid remaining data after end of tuple value", + "INSERT INTO %s (k, l) VALUES (0, ?)", + list(tuple(1, "1", 1.0, 1), tuple(2, "2", 2.0, 2))); + - assertInvalidMessage("Invalid list literal for l: value (1, '1', 1.0, 1) is not of type tuple<int, text, double>", ++ assertInvalidMessage("Invalid list literal for l: value (1, '1', 1.0, 1) is not of type frozen<tuple<int, text, double>>", + "INSERT INTO %s (k, l) VALUES (0, [(1, '1', 1.0, 1)])"); + + createTable("CREATE TABLE %s (k int PRIMARY KEY, m frozen<map<tuple<int, text, double>, int>>)"); + assertInvalidMessage("Invalid remaining data after end of tuple value", + "INSERT INTO %s (k, m) VALUES (0, ?)", + map(tuple(1, "1", 1.0, 1), 1, tuple(2, "2", 2.0, 2), 2)); + - assertInvalidMessage("Invalid map literal for m: key (1, '1', 1.0, 1) is not of type tuple<int, text, double>", ++ assertInvalidMessage("Invalid map literal for m: key (1, '1', 1.0, 1) is not of type frozen<tuple<int, text, double>>", + "INSERT INTO %s (k, m) VALUES (0, {(1, '1', 1.0, 1) : 1})"); + + createTable("CREATE TABLE %s (k int PRIMARY KEY, m frozen<map<int, tuple<int, text, double>>>)"); + assertInvalidMessage("Invalid remaining data after end of tuple value", + "INSERT INTO %s (k, m) VALUES (0, ?)", + map(1, tuple(1, "1", 1.0, 1), 2, tuple(2, "2", 2.0, 2))); + - assertInvalidMessage("Invalid map literal for m: value (1, '1', 1.0, 1) is not of type tuple<int, text, double>", ++ assertInvalidMessage("Invalid map literal for m: value (1, '1', 1.0, 1) is not of type frozen<tuple<int, text, double>>", + "INSERT INTO %s (k, m) VALUES (0, {1 : (1, '1', 1.0, 1)})"); + } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/e51c85f2/test/unit/org/apache/cassandra/cql3/validation/entities/TupleTypeTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/cql3/validation/entities/TupleTypeTest.java index c369ecd,3b4fb40..cbe4a15 --- a/test/unit/org/apache/cassandra/cql3/validation/entities/TupleTypeTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/entities/TupleTypeTest.java @@@ -121,8 -121,16 +121,16 @@@ public class TupleTypeTest extends CQLT assertInvalidSyntax("INSERT INTO %s (k, t) VALUES (0, ())"); - assertInvalidMessage("Invalid tuple literal for t: too many elements. Type tuple<int, text, double> expects 3 but got 4", + assertInvalidMessage("Invalid tuple literal for t: too many elements. Type frozen<tuple<int, text, double>> expects 3 but got 4", "INSERT INTO %s (k, t) VALUES (0, (2, 'foo', 3.1, 'bar'))"); + + createTable("CREATE TABLE %s (k int PRIMARY KEY, t frozen<tuple<int, tuple<int, text, double>>>)"); + assertInvalidMessage("Invalid remaining data after end of tuple value", + "INSERT INTO %s (k, t) VALUES (0, ?)", + tuple(1, tuple(1, "1", 1.0, 1))); + - assertInvalidMessage("Invalid tuple literal for t: component 1 is not of type tuple<int, text, double>", ++ assertInvalidMessage("Invalid tuple literal for t: component 1 is not of type frozen<tuple<int, text, double>>", + "INSERT INTO %s (k, t) VALUES (0, (1, (1, '1', 1.0, 1)))"); } @Test http://git-wip-us.apache.org/repos/asf/cassandra/blob/e51c85f2/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java ---------------------------------------------------------------------- diff --cc test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java index e776f0e,9bafe4a..c279e00 --- a/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java @@@ -54,6 -53,15 +54,15 @@@ public class UserTypesTest extends CQLT "INSERT INTO %s (pk, t) VALUES (?, ?)", 1, "test"); assertInvalidMessage("Not enough bytes to read 0th field f", "INSERT INTO %s (pk, t) VALUES (?, ?)", 1, Long.MAX_VALUE); + + String type = createType("CREATE TYPE %s (a int, b tuple<int, text, double>)"); + createTable("CREATE TABLE %s (k int PRIMARY KEY, t frozen<" + type + ">)"); + assertInvalidMessage("Invalid remaining data after end of tuple value", + "INSERT INTO %s (k, t) VALUES (0, ?)", + userType(1, tuple(1, "1", 1.0, 1))); + - assertInvalidMessage("Invalid user type literal for t: field b is not of type tuple<int, text, double>", ++ assertInvalidMessage("Invalid user type literal for t: field b is not of type frozen<tuple<int, text, double>>", + "INSERT INTO %s (k, t) VALUES (0, {a: 1, b: (1, '1', 1.0, 1)})"); } @Test --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org