Repository: cassandra
Updated Branches:
  refs/heads/trunk c3373012d -> 855dd0eee


Don't add localhost to the graph when calculating where to stream from

Patch by marcuse; reviewed by Ariel Weisberg for CASSANDRA-13583


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

Branch: refs/heads/trunk
Commit: 855dd0eeeee4b8cd00bca48a40f1210efa8bd7f8
Parents: c337301
Author: Marcus Eriksson <[email protected]>
Authored: Tue Jun 20 10:04:17 2017 +0200
Committer: Marcus Eriksson <[email protected]>
Committed: Mon Jul 17 09:56:13 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 .../org/apache/cassandra/dht/RangeFetchMapCalculator.java   | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/855dd0ee/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 087bacc..0be0e39 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Don't add localhost to the graph when calculating where to stream from 
(CASSANDRA-13583)
  * Allow skipping equality-restricted clustering columns in ORDER BY clause 
(CASSANDRA-10271)
  * Use common nowInSec for validation compactions (CASSANDRA-13671)
  * Improve handling of IR prepare failures (CASSANDRA-13672)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/855dd0ee/src/java/org/apache/cassandra/dht/RangeFetchMapCalculator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/dht/RangeFetchMapCalculator.java 
b/src/java/org/apache/cassandra/dht/RangeFetchMapCalculator.java
index 355d7a9..1186eab 100644
--- a/src/java/org/apache/cassandra/dht/RangeFetchMapCalculator.java
+++ b/src/java/org/apache/cassandra/dht/RangeFetchMapCalculator.java
@@ -251,8 +251,7 @@ public class RangeFetchMapCalculator
                 sourceFound = addEndpoints(capacityGraph, rangeVertex, false);
             }
 
-            //We could not find any source for this range which passed the 
filters. Ignore if localhost is part of the endpoints for this range
-            if (!sourceFound && 
!rangesWithSources.get(range).contains(FBUtilities.getBroadcastAddress()))
+            if (!sourceFound)
                 throw new IllegalStateException("Unable to find sufficient 
sources for streaming range " + range + " in keyspace " + keyspace);
 
         }
@@ -275,6 +274,9 @@ public class RangeFetchMapCalculator
             if (passFilters(endpoint, localDCCheck))
             {
                 sourceFound = true;
+                // if we pass filters, it means that we don't filter away 
localhost and we can count it as a source:
+                if (endpoint.equals(FBUtilities.getBroadcastAddress()))
+                    continue; // but don't add localhost to the graph to avoid 
streaming locally
                 final Vertex endpointVertex = new EndpointVertex(endpoint);
                 capacityGraph.insertVertex(rangeVertex);
                 capacityGraph.insertVertex(endpointVertex);
@@ -303,9 +305,6 @@ public class RangeFetchMapCalculator
                 return false;
         }
 
-        if(endpoint.equals(FBUtilities.getBroadcastAddress()))
-            return false;
-
         return !localDCCheck || isInLocalDC(endpoint);
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to