You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2014/08/14 15:54:35 UTC

[2/4] git commit: Skip strict endpoint selection for ranges if RF == nodes

Skip strict endpoint selection for ranges if RF == nodes

Patch by Sam Tunnicliffe; reviewed by tjake for CASSANDRA-7765


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

Branch: refs/heads/trunk
Commit: e4e56c2fd08037b4ddc7459f341e2c86c272e803
Parents: ed3694b
Author: beobal <sa...@beobal.com>
Authored: Wed Aug 13 21:10:52 2014 +0100
Committer: Jake Luciani <ja...@apache.org>
Committed: Thu Aug 14 09:51:45 2014 -0400

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


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4e56c2f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2913607..058681a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.0-rc6
+ * Skip strict endpoint selection for ranges if RF == nodes (CASSANRA-7765)
  * Fix Thrift range filtering without 2ary index lookups (CASSANDRA-7741)
  * Add tracing entries about concurrent range requests (CASSANDRA-7599)
  * (cqlsh) Fix DESCRIBE for NTS keyspaces (CASSANDRA-7729)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e4e56c2f/src/java/org/apache/cassandra/dht/RangeStreamer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/RangeStreamer.java b/src/java/org/apache/cassandra/dht/RangeStreamer.java
index c5d45f9..d84a951 100644
--- a/src/java/org/apache/cassandra/dht/RangeStreamer.java
+++ b/src/java/org/apache/cassandra/dht/RangeStreamer.java
@@ -128,7 +128,7 @@ public class RangeStreamer
 
     public void addRanges(String keyspaceName, Collection<Range<Token>> ranges)
     {
-        Multimap<Range<Token>, InetAddress> rangesForKeyspace = !DatabaseDescriptor.isReplacing() && useStrictConsistency && tokens != null
+        Multimap<Range<Token>, InetAddress> rangesForKeyspace = useStrictSourcesForRanges(keyspaceName)
                 ? getAllRangesWithStrictSourcesFor(keyspaceName, ranges) : getAllRangesWithSourcesFor(keyspaceName, ranges);
 
         if (logger.isDebugEnabled())
@@ -148,6 +148,15 @@ public class RangeStreamer
         }
     }
 
+    private boolean useStrictSourcesForRanges(String keyspaceName)
+    {
+        AbstractReplicationStrategy strat = Keyspace.open(keyspaceName).getReplicationStrategy();
+        return !DatabaseDescriptor.isReplacing()
+                && useStrictConsistency
+                && tokens != null
+                && metadata.getAllEndpoints().size() != strat.getReplicationFactor();
+    }
+
     /**
      * Get a map of all ranges and their respective sources that are candidates for streaming the given ranges
      * to us. For each range, the list of sources is sorted by proximity relative to the given destAddress.