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/cassandra-2.1 Commit: e4e56c2fd08037b4ddc7459f341e2c86c272e803 Parents: ed3694b Author: beobal <s...@beobal.com> Authored: Wed Aug 13 21:10:52 2014 +0100 Committer: Jake Luciani <j...@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.