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/e6f23e63 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e6f23e63 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e6f23e63 Branch: refs/heads/trunk Commit: e6f23e63c58368871a085201f73f139e112d4b3a Parents: 6e5d16b 1de63e9 Author: Robert Stupp <[email protected]> Authored: Fri Sep 18 09:52:08 2015 +0200 Committer: Robert Stupp <[email protected]> Committed: Fri Sep 18 09:52:08 2015 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cql3/statements/AlterTypeStatement.java | 6 ++- .../cassandra/db/marshal/AbstractType.java | 8 ++++ .../cassandra/db/marshal/CompositeType.java | 11 +++++ .../apache/cassandra/db/marshal/ListType.java | 6 +++ .../apache/cassandra/db/marshal/MapType.java | 6 +++ .../cassandra/db/marshal/ReversedType.java | 5 ++ .../apache/cassandra/db/marshal/SetType.java | 6 +++ .../apache/cassandra/db/marshal/TupleType.java | 11 +++++ .../cql3/validation/entities/UserTypesTest.java | 49 ++++++++++++++++++++ 10 files changed, 108 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 6a630fd,97858c5..a1ba955 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,18 -1,15 +1,19 @@@ -2.2.2 +3.0.0-rc1 + * Improve MV schema representation (CASSANDRA-9921) + * Add flag to enable/disable coordinator batchlog for MV writes (CASSANDRA-10230) + * Update cqlsh COPY for new internal driver serialization interface (CASSANDRA-10318) + * Give index implementations more control over rebuild operations (CASSANDRA-10312) + * Update index file format (CASSANDRA-10314) + * Add "shadowable" row tombstones to deal with mv timestamp issues (CASSANDRA-10261) + * CFS.loadNewSSTables() broken for pre-3.0 sstables + * Cache selected index in read command to reduce lookups (CASSANDRA-10215) + * Small optimizations of sstable index serialization (CASSANDRA-10232) + * Support for both encrypted and unencrypted native transport connections (CASSANDRA-9590) +Merged from 2.2: * Defer default role manager setup until all nodes are on 2.2+ (CASSANDRA-9761) - * Cancel transaction for sstables we wont redistribute index summary - for (CASSANDRA-10270) - * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209) - * Retry snapshot deletion after compaction and gc on Windows (CASSANDRA-10222) - * Fix failure to start with space in directory path on Windows (CASSANDRA-10239) - * Fix repair hang when snapshot failed (CASSANDRA-10057) - * Fall back to 1/4 commitlog volume for commitlog_total_space on small disks - (CASSANDRA-10199) + * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209) Merged from 2.1: + * Prevent ALTER TYPE from creating circular references (CASSANDRA-10339) * Fix cache handling of 2i and base tables (CASSANDRA-10155, 10359) * Fix NPE in nodetool compactionhistory (CASSANDRA-9758) * (Pig) support BulkOutputFormat as a URL parameter (CASSANDRA-7410) http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/cql3/statements/AlterTypeStatement.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/db/marshal/AbstractType.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/marshal/AbstractType.java index 02a5539,b90e127..5c46823 --- a/src/java/org/apache/cassandra/db/marshal/AbstractType.java +++ b/src/java/org/apache/cassandra/db/marshal/AbstractType.java @@@ -357,50 -296,14 +357,58 @@@ public abstract class AbstractType<T> i } /** + * The length of values for this type if all values are of fixed length, -1 otherwise. + */ + protected int valueLengthIfFixed() + { + return -1; + } + + // This assumes that no empty values are passed + public void writeValue(ByteBuffer value, DataOutputPlus out) throws IOException + { + assert value.hasRemaining(); + if (valueLengthIfFixed() >= 0) + out.write(value); + else + ByteBufferUtil.writeWithVIntLength(value, out); + } + + public long writtenLength(ByteBuffer value) + { + assert value.hasRemaining(); + return valueLengthIfFixed() >= 0 + ? value.remaining() + : TypeSizes.sizeofWithVIntLength(value); + } + + public ByteBuffer readValue(DataInputPlus in) throws IOException + { + int length = valueLengthIfFixed(); + if (length >= 0) + return ByteBufferUtil.read(in, length); + else + return ByteBufferUtil.readWithVIntLength(in); + } + + public void skipValue(DataInputPlus in) throws IOException + { + int length = valueLengthIfFixed(); + if (length >= 0) + FileUtils.skipBytesFully(in, length); + else + ByteBufferUtil.skipWithVIntLength(in); + } + + /** + * Checks whether this type or any of the types this type contains references the given type. + */ + public boolean references(AbstractType<?> check) + { + return this.equals(check); + } + + /** * This must be overriden by subclasses if necessary so that for any * AbstractType, this == TypeParser.parse(toString()). * http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/db/marshal/CompositeType.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/db/marshal/ListType.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/db/marshal/MapType.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/db/marshal/ReversedType.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/marshal/ReversedType.java index 2f4fdb7,68a7e02..4f1f7a2 --- a/src/java/org/apache/cassandra/db/marshal/ReversedType.java +++ b/src/java/org/apache/cassandra/db/marshal/ReversedType.java @@@ -135,13 -128,12 +135,18 @@@ public class ReversedType<T> extends Ab return baseType.getSerializer(); } + public boolean references(AbstractType<?> check) + { + return super.references(check) || baseType.references(check); + } + @Override + protected int valueLengthIfFixed() + { + return baseType.valueLengthIfFixed(); + } + + @Override public boolean isReversed() { return true; http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/db/marshal/SetType.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/src/java/org/apache/cassandra/db/marshal/TupleType.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6f23e63/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java ----------------------------------------------------------------------
