Merge branch 'cassandra-2.1.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f454fecf Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f454fecf Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f454fecf Branch: refs/heads/cassandra-2.1 Commit: f454fecf6ed11ff27c2b6b472ba0b1c88dcc1985 Parents: 5549680 56db001 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Mon Aug 18 14:25:29 2014 +0200 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Mon Aug 18 14:25:29 2014 +0200 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/db/AbstractNativeCell.java | 11 ++++++++++ .../cassandra/db/composites/AbstractCType.java | 22 ++++++++++++++++++++ .../composites/CompoundSparseCellNameType.java | 11 ++++++++++ 4 files changed, 45 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f454fecf/CHANGES.txt ---------------------------------------------------------------------- diff --cc CHANGES.txt index 2e6b184,8aafd98..9ab4109 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,34 -1,5 +1,35 @@@ +2.1.1 + * Support list index operations with conditions (CASSANDRA-7499) + * Add max live/tombstoned cells to nodetool cfstats output (CASSANDRA-7731) + * Validate IPv6 wildcard addresses properly (CASSANDRA-7680) + * (cqlsh) Error when tracing query (CASSANDRA-7613) + * Avoid IOOBE when building SyntaxError message snippet (CASSANDRA-7569) + * SSTableExport uses correct validator to create string representation of partition + keys (CASSANDRA-7498) + * Avoid NPEs when receiving type changes for an unknown keyspace (CASSANDRA-7689) + * Add support for custom 2i validation (CASSANDRA-7575) + * Pig support for hadoop CqlInputFormat (CASSANDRA-6454) + * Add listen_interface and rpc_interface options (CASSANDRA-7417) + * Improve schema merge performance (CASSANDRA-7444) + * Adjust MT depth based on # of partition validating (CASSANDRA-5263) + * Optimise NativeCell comparisons (CASSANDRA-6755) + * Configurable client timeout for cqlsh (CASSANDRA-7516) + * Include snippet of CQL query near syntax error in messages (CASSANDRA-7111) +Merged from 2.0: + * (Hadoop) allow ACFRW to limit nodes to local DC (CASSANDRA-7252) + * (cqlsh) cqlsh should automatically disable tracing when selecting + from system_traces (CASSANDRA-7641) + * (Hadoop) Add CqlOutputFormat (CASSANDRA-6927) + * Don't depend on cassandra config for nodetool ring (CASSANDRA-7508) + * (cqlsh) Fix failing cqlsh formatting tests (CASSANDRA-7703) + * Fix IncompatibleClassChangeError from hadoop2 (CASSANDRA-7229) + * Add 'nodetool sethintedhandoffthrottlekb' (CASSANDRA-7635) + * (cqlsh) Add tab-completion for CREATE/DROP USER IF [NOT] EXISTS (CASSANDRA-7611) + * Catch errors when the JVM pulls the rug out from GCInspector (CASSANDRA-5345) + * cqlsh fails when version number parts are not int (CASSANDRA-7524) + 2.1.0 + * Fix ordering of static cells (CASSANDRA-7763) Merged from 2.0: * Fix dropping collection when it's the last regular column (CASSANDRA-7744) * Properly reject operations on list index with conditions (CASSANDRA-7499) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f454fecf/src/java/org/apache/cassandra/db/AbstractNativeCell.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/AbstractNativeCell.java index d79ad19,f3128b8..7e85af3 --- a/src/java/org/apache/cassandra/db/AbstractNativeCell.java +++ b/src/java/org/apache/cassandra/db/AbstractNativeCell.java @@@ -658,38 -645,4 +658,49 @@@ public abstract class AbstractNativeCel checkPosition(offset, length); return MemoryUtil.getByteBuffer(peer + offset, length); } + + // requires isByteOrderComparable to be true. Compares the name components only; ; may need to compare EOC etc still + public final int compareTo(final Composite that) + { ++ if (isStatic() != that.isStatic()) ++ { ++ // Static sorts before non-static no matter what, except for empty which ++ // always sort first ++ if (isEmpty()) ++ return that.isEmpty() ? 0 : -1; ++ if (that.isEmpty()) ++ return 1; ++ return isStatic() ? -1 : 1; ++ } ++ + int size = size(); + int size2 = that.size(); + int minSize = Math.min(size, size2); + int startDelta = 0; + int cellNamesOffset = nameDeltaOffset(size); + for (int i = 0 ; i < minSize ; i++) + { + int endDelta = i < size - 1 ? getShort(nameDeltaOffset(i + 1)) : valueStartOffset() - cellNamesOffset; + long offset = peer + cellNamesOffset + startDelta; + int length = endDelta - startDelta; + int cmp = FastByteOperations.UnsafeOperations.compareTo(null, offset, length, that.get(i)); + if (cmp != 0) + return cmp; + startDelta = endDelta; + } + + EOC eoc = that.eoc(); + if (size == size2) + return this.eoc().compareTo(eoc); + + return size < size2 ? this.eoc().prefixComparisonResult : -eoc.prefixComparisonResult; + } + + public final int compareToSimple(final Composite that) + { + assert size() == 1 && that.size() == 1; + int length = valueStartOffset() - nameDeltaOffset(1); + long offset = peer + nameDeltaOffset(1); + return FastByteOperations.UnsafeOperations.compareTo(null, offset, length, that.get(0)); + } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/f454fecf/src/java/org/apache/cassandra/db/composites/AbstractCType.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/db/composites/AbstractCType.java index 491a9d1,0e206c7..5af7458 --- a/src/java/org/apache/cassandra/db/composites/AbstractCType.java +++ b/src/java/org/apache/cassandra/db/composites/AbstractCType.java @@@ -132,37 -102,41 +132,59 @@@ public abstract class AbstractCType imp return isByteOrderComparable; } - public int compare(Composite c1, Composite c2) + static int compareUnsigned(Composite c1, Composite c2) { + if (c1.isStatic() != c2.isStatic()) + { + // Static sorts before non-static no matter what, except for empty which + // always sort first + if (c1.isEmpty()) + return c2.isEmpty() ? 0 : -1; + if (c2.isEmpty()) + return 1; + return c1.isStatic() ? -1 : 1; + } + int s1 = c1.size(); int s2 = c2.size(); int minSize = Math.min(s1, s2); - if (isByteOrderComparable) + for (int i = 0; i < minSize; i++) { - for (int i = 0; i < minSize; i++) - { - int cmp = ByteBufferUtil.compareUnsigned(c1.get(i), c2.get(i)); - if (cmp != 0) - return cmp; - } + int cmp = ByteBufferUtil.compareUnsigned(c1.get(i), c2.get(i)); + if (cmp != 0) + return cmp; } - else + + if (s1 == s2) + return c1.eoc().compareTo(c2.eoc()); + return s1 < s2 ? c1.eoc().prefixComparisonResult : -c2.eoc().prefixComparisonResult; + } + + public int compare(Composite c1, Composite c2) + { ++ if (c1.isStatic() != c2.isStatic()) + { - for (int i = 0; i < minSize; i++) - { - AbstractType<?> comparator = subtype(i); - int cmp = comparator.compare(c1.get(i), c2.get(i)); - if (cmp != 0) - return cmp; - } ++ // Static sorts before non-static no matter what, except for empty which ++ // always sort first ++ if (c1.isEmpty()) ++ return c2.isEmpty() ? 0 : -1; ++ if (c2.isEmpty()) ++ return 1; ++ return c1.isStatic() ? -1 : 1; ++ } ++ + int s1 = c1.size(); + int s2 = c2.size(); + int minSize = Math.min(s1, s2); + + for (int i = 0; i < minSize; i++) + { + int cmp = isByteOrderComparable + ? ByteBufferUtil.compareUnsigned(c1.get(i), c2.get(i)) + : subtype(i).compare(c1.get(i), c2.get(i)); + if (cmp != 0) + return cmp; } if (s1 == s2) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f454fecf/src/java/org/apache/cassandra/db/composites/CompoundSparseCellNameType.java ----------------------------------------------------------------------