Use zero as default score in DynamicEndpointSnitch
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/29d6237a Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/29d6237a Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/29d6237a Branch: refs/heads/trunk Commit: 29d6237a00b577400c4b4a63989d41f1baa2aa60 Parents: 656cca7 Author: Dikang Gu <dikan...@gmail.com> Authored: Thu Feb 22 14:35:20 2018 -0800 Committer: Dikang Gu <dikan...@gmail.com> Committed: Tue Mar 20 15:10:06 2018 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java | 2 +- .../org/apache/cassandra/locator/DynamicEndpointSnitchTest.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/29d6237a/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index bae967f..27a25cc 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.11.3 + * Use zero as default score in DynamicEndpointSnitch (CASSANDRA-14252) * SASI tokenizer for simple delimiter based entries (CASSANDRA-14247) * Fix Loss of digits when doing CAST from varint/bigint to decimal (CASSANDRA-14170) * RateBasedBackPressure unnecessarily invokes a lock on the Guava RateLimiter (CASSANDRA-14163) http://git-wip-us.apache.org/repos/asf/cassandra/blob/29d6237a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java index 42fc26c..dce25ee 100644 --- a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java +++ b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java @@ -234,7 +234,7 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa { Double score = scores.get(inet); if (score == null) - continue; + score = 0.0; subsnitchOrderedScores.add(score); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/29d6237a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java b/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java index 8a59a4a..051d2c2 100644 --- a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java +++ b/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java @@ -101,7 +101,7 @@ public class DynamicEndpointSnitchTest assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3, host4))); setScores(dsnitch, 20, hosts, 10, 10, 10); - order = Arrays.asList(host1, host2, host3, host4); + order = Arrays.asList(host4, host1, host2, host3); assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3, host4))); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org