cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marc...@apache.org
Subject [2/3] cassandra git commit: Avoid infinite loop if owned range is smaller than number of data directories
Date Fri, 29 Jan 2016 21:05:42 GMT
Avoid infinite loop if owned range is smaller than number of data directories

Patch by marcuse; reviewed by Carl Yeksigian for CASSANDRA-11034


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

Branch: refs/heads/trunk
Commit: 8bc8fa36907188440579aaf88b2bd397ec4dcf8c
Parents: 573552c
Author: Marcus Eriksson <marcuse@apache.org>
Authored: Fri Jan 29 10:13:55 2016 +0100
Committer: Marcus Eriksson <marcuse@apache.org>
Committed: Fri Jan 29 22:04:09 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bc8fa36/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f9af204..9d58926 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 3.3
+ * Avoid infinite loop if owned range is smaller than number of
+   data dirs (CASSANDRA-11034)
  * Avoid bootstrap hanging when existing nodes have no data to stream (CASSANDRA-11010)
 Merged from 3.0:
  * (cqlsh) handle INSERT and UPDATE statements with LWT conditions correctly

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bc8fa36/src/java/org/apache/cassandra/dht/Splitter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/Splitter.java b/src/java/org/apache/cassandra/dht/Splitter.java
index 67b578d..4268e83 100644
--- a/src/java/org/apache/cassandra/dht/Splitter.java
+++ b/src/java/org/apache/cassandra/dht/Splitter.java
@@ -51,6 +51,9 @@ public abstract class Splitter
             totalTokens = totalTokens.add(right.subtract(valueForToken(r.left)));
         }
         BigInteger perPart = totalTokens.divide(BigInteger.valueOf(parts));
+        // the range owned is so tiny we can't split it:
+        if (perPart.equals(BigInteger.ZERO))
+            return Collections.singletonList(partitioner.getMaximumToken());
 
         if (dontSplitRanges)
             return splitOwnedRangesNoPartialRanges(localRanges, perPart, parts);


Mime
View raw message