cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix bug in Range.intersects(Bound)
Date Thu, 18 Jul 2013 06:53:22 GMT
Updated Branches:
  refs/heads/cassandra-1.2 9382c4b4c -> bbdbc0d1d


Fix bug in Range.intersects(Bound)

patch by slebresne; reviewed by jbellis for CASSANDRA-5771


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

Branch: refs/heads/cassandra-1.2
Commit: bbdbc0d1d92717eb05ddf674641875296ff94802
Parents: 9382c4b
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Jul 17 18:59:04 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Jul 18 08:53:10 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                  | 1 +
 src/java/org/apache/cassandra/dht/Range.java | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/bbdbc0d1/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 09f4c7b..4886aa4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -18,6 +18,7 @@
  * Fix pathetic performance of range tombstones (CASSANDRA-5677)
  * Fix querying with an empty (impossible) range (CASSANDRA-5573)
  * cqlsh: handle CUSTOM 2i in DESCRIBE output (CASSANDRA-5760)
+ * Fix minor bug in Range.intersects(Bound) (CASSANDRA-5771)
 
 
 1.2.6

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bbdbc0d1/src/java/org/apache/cassandra/dht/Range.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/Range.java b/src/java/org/apache/cassandra/dht/Range.java
index c2d7b63..86bc514 100644
--- a/src/java/org/apache/cassandra/dht/Range.java
+++ b/src/java/org/apache/cassandra/dht/Range.java
@@ -136,7 +136,10 @@ public class Range<T extends RingPosition> extends AbstractBounds<T>
implements
      */
     public boolean intersects(Bounds<T> that)
     {
-        return intersects(new Range<T>(that.left, that.right)) || contains(that.left);
+        // Same punishment than in Bounds.contains(), we must be carefull if that.left ==
that.right as
+        // as new Range<T>(that.left, that.right) will then cover the full ring which
is not what we
+        // want.
+        return contains(that.left) || (!that.left.equals(that.right) && intersects(new
Range<T>(that.left, that.right)));
     }
 
     public static <T extends RingPosition> Set<Range<T>> rangeSet(Range<T>
... ranges)


Mime
View raw message