Fix range merging to avoid creating wrapping ones

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

Branch: refs/heads/trunk
Commit: 19972bdd91d6f8117eb8baa957b547000e995de3
Parents: 9717002
Author: Sylvain Lebresne <[email protected]>
Authored: Fri Jan 18 15:19:04 2013 +0100
Committer: Sylvain Lebresne <[email protected]>
Committed: Fri Jan 18 15:19:04 2013 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/service/StorageProxy.java |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/19972bdd/src/java/org/apache/cassandra/service/StorageProxy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java 
b/src/java/org/apache/cassandra/service/StorageProxy.java
index b541332..c234bd1 100644
--- a/src/java/org/apache/cassandra/service/StorageProxy.java
+++ b/src/java/org/apache/cassandra/service/StorageProxy.java
@@ -1146,6 +1146,16 @@ public class StorageProxy implements StorageProxyMBean
                     nextEndpoints = getLiveSortedEndpoints(table, 
nextRange.right);
                     nextFilteredEndpoints = 
consistency_level.filterForQuery(table, nextEndpoints);
 
+                    /*
+                     * If the current range right is the min token, we should 
stop merging because CFS.getRangeSlice
+                     * don't know how to deal with a wrapping range.
+                     * Note: it would be slightly more efficient to have 
CFS.getRangeSlice on the destination nodes unwraps
+                     * the range if necessary and deal with it. However, we 
can't start sending wrapped range without breaking
+                     * wire compatibility, so It's likely easier not to bother;
+                     */
+                    if (range.right.isMinimum())
+                        break;
+
                     List<InetAddress> merged = intersection(liveEndpoints, 
nextEndpoints);
 
                     // Check if there is enough endpoint for the merge to be 
possible.

Reply via email to