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 2015/11/02 15:29:11 UTC
cassandra git commit: Proper implementation of LegacyBoundComparator
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.0 4beb54da5 -> cba5ef609
Proper implementation of LegacyBoundComparator
patch by slebresne; reviewed by blerer for CASSANDRA-10602
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cba5ef60
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cba5ef60
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cba5ef60
Branch: refs/heads/cassandra-3.0
Commit: cba5ef609d6d25380afcb0dff06fe325101c727c
Parents: 4beb54d
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Oct 27 16:27:14 2015 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Mon Nov 2 15:28:45 2015 +0100
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/db/LegacyLayout.java | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cba5ef60/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6d5d49b..1724f01 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0
+ * Fix implementation of LegacyLayout.LegacyBoundComparator (CASSANDRA-10602)
* Don't use 'names query' read path for counters (CASSANDRA-10572)
* Fix backward compatibility for counters (CASSANDRA-10470)
* Remove memory_allocator paramter from cassandra.yaml (CASSANDRA-10581)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cba5ef60/src/java/org/apache/cassandra/db/LegacyLayout.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/LegacyLayout.java b/src/java/org/apache/cassandra/db/LegacyLayout.java
index 6e04559..3c64443 100644
--- a/src/java/org/apache/cassandra/db/LegacyLayout.java
+++ b/src/java/org/apache/cassandra/db/LegacyLayout.java
@@ -1698,10 +1698,26 @@ public abstract class LegacyLayout
public int compare(LegacyBound a, LegacyBound b)
{
+ // In the legacy sorting, BOTTOM comes before anything else
+ if (a == LegacyBound.BOTTOM)
+ return b == LegacyBound.BOTTOM ? 0 : -1;
+ if (b == LegacyBound.BOTTOM)
+ return 1;
+
+ // Excluding BOTTOM, statics are always before anything else.
+ if (a.isStatic != b.isStatic)
+ return a.isStatic ? -1 : 1;
+
int result = this.clusteringComparator.compare(a.bound, b.bound);
if (result != 0)
return result;
+ // If both have equal "bound" but one is a collection tombstone and not the other, then the other comes before as it points to the beginning of the row.
+ if (a.collectionName == null)
+ return b.collectionName == null ? 0 : 1;
+ if (b.collectionName == null)
+ return -1;
+
return UTF8Type.instance.compare(a.collectionName.name.bytes, b.collectionName.name.bytes);
}
}