You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2014/02/25 17:45:14 UTC
[1/6] git commit: Compare scores of full replica ordering in DES.
Patch by Tyler Hobbs, reviewed by brandonwilliams for CASSANDRA-6883
Repository: cassandra
Updated Branches:
refs/heads/cassandra-2.0 cd2c43884 -> d21c0c932
refs/heads/cassandra-2.1 47a787a91 -> 85f67aa9c
refs/heads/trunk 8aea1617e -> d697ba6f5
Compare scores of full replica ordering in DES.
Patch by Tyler Hobbs, reviewed by brandonwilliams for CASSANDRA-6883
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d21c0c93
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d21c0c93
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d21c0c93
Branch: refs/heads/cassandra-2.0
Commit: d21c0c932c7d962feb958159578cf2cfb471a648
Parents: cd2c438
Author: Brandon Williams <br...@apache.org>
Authored: Tue Feb 25 10:40:58 2014 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Feb 25 10:42:02 2014 -0600
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../locator/DynamicEndpointSnitch.java | 25 +++--
.../locator/DynamicEndpointSnitchTest.java | 108 ++++++++-----------
3 files changed, 61 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f3a854c..ee138ce 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.6
+ * Compare scores of full replica ordering in DES (CASSANDRA-6883)
* fix CME in SessionInfo updateProgress affecting netstats (CASSANDRA-6577)
* Allow repairing between specific replicas (CASSANDRA-6440)
* Allow per-dc enabling of hints (CASSANDRA-6157)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/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 e9d55d4..00c3618 100644
--- a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
+++ b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
@@ -156,16 +156,27 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
{
if (addresses.size() < 2)
return;
+
subsnitch.sortByProximity(address, addresses);
- Double first = scores.get(addresses.get(0));
- if (first == null)
- return;
- for (InetAddress addr : addresses)
+ ArrayList<Double> subsnitchOrderedScores = new ArrayList<>(addresses.size());
+ for (InetAddress inet : addresses)
{
- Double next = scores.get(addr);
- if (next == null)
+ Double score = scores.get(inet);
+ if (score == null)
return;
- if ((first - next) / first > BADNESS_THRESHOLD)
+ subsnitchOrderedScores.add(score);
+ }
+
+ // Sort the scores and then compare them (positionally) to the scores in the subsnitch order.
+ // If any of the subsnitch-ordered scores exceed the optimal/sorted score by BADNESS_THRESHOLD, use
+ // the score-sorted ordering instead of the subsnitch ordering.
+ ArrayList<Double> sortedScores = new ArrayList<>(subsnitchOrderedScores);
+ Collections.sort(sortedScores);
+
+ Iterator<Double> sortedScoreIterator = sortedScores.iterator();
+ for (Double subsnitchScore : subsnitchOrderedScores)
+ {
+ if (subsnitchScore > (sortedScoreIterator.next() * (1.0 + BADNESS_THRESHOLD)))
{
sortByProximityWithScore(address, addresses);
return;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/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 dca87a2..e23bcfa 100644
--- a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
+++ b/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
@@ -21,7 +21,8 @@ package org.apache.cassandra.locator;
import java.io.IOException;
import java.net.InetAddress;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.service.StorageService;
@@ -29,89 +30,64 @@ import org.junit.Test;
import org.apache.cassandra.utils.FBUtilities;
+import static org.junit.Assert.assertEquals;
+
public class DynamicEndpointSnitchTest
{
+
+ private static void setScores(DynamicEndpointSnitch dsnitch, int rounds, List<InetAddress> hosts, Integer... scores) throws InterruptedException
+ {
+ for (int round = 0; round < rounds; round++)
+ {
+ for (int i = 0; i < hosts.size(); i++)
+ dsnitch.receiveTiming(hosts.get(i), scores[i]);
+ }
+ Thread.sleep(150);
+ }
+
@Test
public void testSnitch() throws InterruptedException, IOException, ConfigurationException
{
// do this because SS needs to be initialized before DES can work properly.
StorageService.instance.initClient(0);
- int sleeptime = 150;
SimpleSnitch ss = new SimpleSnitch();
DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch(ss, String.valueOf(ss.hashCode()));
InetAddress self = FBUtilities.getBroadcastAddress();
- ArrayList<InetAddress> order = new ArrayList<InetAddress>();
- InetAddress host1 = InetAddress.getByName("127.0.0.4");
- InetAddress host2 = InetAddress.getByName("127.0.0.2");
- InetAddress host3 = InetAddress.getByName("127.0.0.3");
+ InetAddress host1 = InetAddress.getByName("127.0.0.2");
+ InetAddress host2 = InetAddress.getByName("127.0.0.3");
+ InetAddress host3 = InetAddress.getByName("127.0.0.4");
+ List<InetAddress> hosts = Arrays.asList(host1, host2, host3);
// first, make all hosts equal
- for (int i = 0; i < 5; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- }
-
- Thread.sleep(sleeptime);
-
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 1, hosts, 10, 10, 10);
+ List<InetAddress> order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host1 a little worse
- dsnitch.receiveTiming(host1, 2L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host2);
- order.add(host3);
- order.add(host1);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 1, hosts, 20, 10, 10);
+ order = Arrays.asList(host2, host3, host1);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host2 as bad as host1
- dsnitch.receiveTiming(host2, 2L);
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host3, 1L);
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host3);
- order.add(host1);
- order.add(host2);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 2, hosts, 15, 20, 10);
+ order = Arrays.asList(host3, host1, host2);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host3 the worst
- for (int i = 0; i < 2; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 2L);
- }
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 3, hosts, 10, 10, 30);
+ order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host3 equal to the others
- for (int i = 0; i < 2; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- }
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 5, hosts, 10, 10, 10);
+ order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
+
+ /// Tests CASSANDRA-6683 improvements
+ // make the scores differ enough from the ideal order that we sort by score; under the old
+ // dynamic snitch behavior (where we only compared neighbors), these wouldn't get sorted
+ setScores(dsnitch, 20, hosts, 10, 70, 20);
+ order = Arrays.asList(host1, host3, host2);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
}
-}
+}
\ No newline at end of file
[2/6] git commit: Compare scores of full replica ordering in DES.
Patch by Tyler Hobbs, reviewed by brandonwilliams for CASSANDRA-6883
Posted by br...@apache.org.
Compare scores of full replica ordering in DES.
Patch by Tyler Hobbs, reviewed by brandonwilliams for CASSANDRA-6883
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d21c0c93
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d21c0c93
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d21c0c93
Branch: refs/heads/cassandra-2.1
Commit: d21c0c932c7d962feb958159578cf2cfb471a648
Parents: cd2c438
Author: Brandon Williams <br...@apache.org>
Authored: Tue Feb 25 10:40:58 2014 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Feb 25 10:42:02 2014 -0600
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../locator/DynamicEndpointSnitch.java | 25 +++--
.../locator/DynamicEndpointSnitchTest.java | 108 ++++++++-----------
3 files changed, 61 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f3a854c..ee138ce 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.6
+ * Compare scores of full replica ordering in DES (CASSANDRA-6883)
* fix CME in SessionInfo updateProgress affecting netstats (CASSANDRA-6577)
* Allow repairing between specific replicas (CASSANDRA-6440)
* Allow per-dc enabling of hints (CASSANDRA-6157)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/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 e9d55d4..00c3618 100644
--- a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
+++ b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
@@ -156,16 +156,27 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
{
if (addresses.size() < 2)
return;
+
subsnitch.sortByProximity(address, addresses);
- Double first = scores.get(addresses.get(0));
- if (first == null)
- return;
- for (InetAddress addr : addresses)
+ ArrayList<Double> subsnitchOrderedScores = new ArrayList<>(addresses.size());
+ for (InetAddress inet : addresses)
{
- Double next = scores.get(addr);
- if (next == null)
+ Double score = scores.get(inet);
+ if (score == null)
return;
- if ((first - next) / first > BADNESS_THRESHOLD)
+ subsnitchOrderedScores.add(score);
+ }
+
+ // Sort the scores and then compare them (positionally) to the scores in the subsnitch order.
+ // If any of the subsnitch-ordered scores exceed the optimal/sorted score by BADNESS_THRESHOLD, use
+ // the score-sorted ordering instead of the subsnitch ordering.
+ ArrayList<Double> sortedScores = new ArrayList<>(subsnitchOrderedScores);
+ Collections.sort(sortedScores);
+
+ Iterator<Double> sortedScoreIterator = sortedScores.iterator();
+ for (Double subsnitchScore : subsnitchOrderedScores)
+ {
+ if (subsnitchScore > (sortedScoreIterator.next() * (1.0 + BADNESS_THRESHOLD)))
{
sortByProximityWithScore(address, addresses);
return;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/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 dca87a2..e23bcfa 100644
--- a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
+++ b/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
@@ -21,7 +21,8 @@ package org.apache.cassandra.locator;
import java.io.IOException;
import java.net.InetAddress;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.service.StorageService;
@@ -29,89 +30,64 @@ import org.junit.Test;
import org.apache.cassandra.utils.FBUtilities;
+import static org.junit.Assert.assertEquals;
+
public class DynamicEndpointSnitchTest
{
+
+ private static void setScores(DynamicEndpointSnitch dsnitch, int rounds, List<InetAddress> hosts, Integer... scores) throws InterruptedException
+ {
+ for (int round = 0; round < rounds; round++)
+ {
+ for (int i = 0; i < hosts.size(); i++)
+ dsnitch.receiveTiming(hosts.get(i), scores[i]);
+ }
+ Thread.sleep(150);
+ }
+
@Test
public void testSnitch() throws InterruptedException, IOException, ConfigurationException
{
// do this because SS needs to be initialized before DES can work properly.
StorageService.instance.initClient(0);
- int sleeptime = 150;
SimpleSnitch ss = new SimpleSnitch();
DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch(ss, String.valueOf(ss.hashCode()));
InetAddress self = FBUtilities.getBroadcastAddress();
- ArrayList<InetAddress> order = new ArrayList<InetAddress>();
- InetAddress host1 = InetAddress.getByName("127.0.0.4");
- InetAddress host2 = InetAddress.getByName("127.0.0.2");
- InetAddress host3 = InetAddress.getByName("127.0.0.3");
+ InetAddress host1 = InetAddress.getByName("127.0.0.2");
+ InetAddress host2 = InetAddress.getByName("127.0.0.3");
+ InetAddress host3 = InetAddress.getByName("127.0.0.4");
+ List<InetAddress> hosts = Arrays.asList(host1, host2, host3);
// first, make all hosts equal
- for (int i = 0; i < 5; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- }
-
- Thread.sleep(sleeptime);
-
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 1, hosts, 10, 10, 10);
+ List<InetAddress> order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host1 a little worse
- dsnitch.receiveTiming(host1, 2L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host2);
- order.add(host3);
- order.add(host1);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 1, hosts, 20, 10, 10);
+ order = Arrays.asList(host2, host3, host1);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host2 as bad as host1
- dsnitch.receiveTiming(host2, 2L);
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host3, 1L);
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host3);
- order.add(host1);
- order.add(host2);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 2, hosts, 15, 20, 10);
+ order = Arrays.asList(host3, host1, host2);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host3 the worst
- for (int i = 0; i < 2; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 2L);
- }
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 3, hosts, 10, 10, 30);
+ order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host3 equal to the others
- for (int i = 0; i < 2; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- }
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 5, hosts, 10, 10, 10);
+ order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
+
+ /// Tests CASSANDRA-6683 improvements
+ // make the scores differ enough from the ideal order that we sort by score; under the old
+ // dynamic snitch behavior (where we only compared neighbors), these wouldn't get sorted
+ setScores(dsnitch, 20, hosts, 10, 70, 20);
+ order = Arrays.asList(host1, host3, host2);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
}
-}
+}
\ No newline at end of file
[6/6] git commit: Merge branch 'cassandra-2.1' into trunk
Posted by br...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d697ba6f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d697ba6f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d697ba6f
Branch: refs/heads/trunk
Commit: d697ba6f5646baa4f3ed959fd1d356ba3fb253ee
Parents: 8aea161 85f67aa
Author: Brandon Williams <br...@apache.org>
Authored: Tue Feb 25 10:42:20 2014 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Feb 25 10:42:20 2014 -0600
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../locator/DynamicEndpointSnitch.java | 25 +++--
.../locator/DynamicEndpointSnitchTest.java | 108 ++++++++-----------
3 files changed, 61 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d697ba6f/CHANGES.txt
----------------------------------------------------------------------
[4/6] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/85f67aa9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/85f67aa9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/85f67aa9
Branch: refs/heads/trunk
Commit: 85f67aa9c647af9353e22bf1b4434e0fa93f23c7
Parents: 47a787a d21c0c9
Author: Brandon Williams <br...@apache.org>
Authored: Tue Feb 25 10:42:11 2014 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Feb 25 10:42:11 2014 -0600
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../locator/DynamicEndpointSnitch.java | 25 +++--
.../locator/DynamicEndpointSnitchTest.java | 108 ++++++++-----------
3 files changed, 61 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/85f67aa9/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index ce5a11d,ee138ce..65ce8c2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,50 -1,5 +1,51 @@@
+2.1.0-beta2
+ * Fix overflow of memtable_total_space_in_mb (CASSANDRA-6573)
+ * Fix ABTC NPE (CASSANDRA-6692)
+ * Allow nodetool to use a file or prompt for password (CASSANDRA-6660)
+ * Fix AIOOBE when concurrently accessing ABSC (CASSANDRA-6742)
+ * Fix assertion error in ALTER TYPE RENAME (CASSANDRA-6705)
+ * Scrub should not always clear out repaired status (CASSANDRA-5351)
+
+2.1.0-beta1
+ * Add flush directory distinct from compaction directories (CASSANDRA-6357)
+ * Require JNA by default (CASSANDRA-6575)
+ * add listsnapshots command to nodetool (CASSANDRA-5742)
+ * Introduce AtomicBTreeColumns (CASSANDRA-6271, 6692)
+ * Multithreaded commitlog (CASSANDRA-3578)
+ * allocate fixed index summary memory pool and resample cold index summaries
+ to use less memory (CASSANDRA-5519)
+ * Removed multithreaded compaction (CASSANDRA-6142)
+ * Parallelize fetching rows for low-cardinality indexes (CASSANDRA-1337)
+ * change logging from log4j to logback (CASSANDRA-5883)
+ * switch to LZ4 compression for internode communication (CASSANDRA-5887)
+ * Stop using Thrift-generated Index* classes internally (CASSANDRA-5971)
+ * Remove 1.2 network compatibility code (CASSANDRA-5960)
+ * Remove leveled json manifest migration code (CASSANDRA-5996)
+ * Remove CFDefinition (CASSANDRA-6253)
+ * Use AtomicIntegerFieldUpdater in RefCountedMemory (CASSANDRA-6278)
+ * User-defined types for CQL3 (CASSANDRA-5590)
+ * Use of o.a.c.metrics in nodetool (CASSANDRA-5871, 6406)
+ * Batch read from OTC's queue and cleanup (CASSANDRA-1632)
+ * Secondary index support for collections (CASSANDRA-4511, 6383)
+ * SSTable metadata(Stats.db) format change (CASSANDRA-6356)
+ * Push composites support in the storage engine
+ (CASSANDRA-5417, CASSANDRA-6520)
+ * Add snapshot space used to cfstats (CASSANDRA-6231)
+ * Add cardinality estimator for key count estimation (CASSANDRA-5906)
+ * CF id is changed to be non-deterministic. Data dir/key cache are created
+ uniquely for CF id (CASSANDRA-5202)
+ * New counters implementation (CASSANDRA-6504)
+ * Replace UnsortedColumns, EmptyColumns, TreeMapBackedSortedColumns with new
+ ArrayBackedSortedColumns (CASSANDRA-6630, CASSANDRA-6662, CASSANDRA-6690)
+ * Add option to use row cache with a given amount of rows (CASSANDRA-5357)
+ * Avoid repairing already repaired data (CASSANDRA-5351)
+ * Reject counter updates with USING TTL/TIMESTAMP (CASSANDRA-6649)
+ * Replace index_interval with min/max_index_interval (CASSANDRA-6379)
+ * Lift limitation that order by columns must be selected for IN queries (CASSANDRA-4911)
+
+
2.0.6
+ * Compare scores of full replica ordering in DES (CASSANDRA-6883)
* fix CME in SessionInfo updateProgress affecting netstats (CASSANDRA-6577)
* Allow repairing between specific replicas (CASSANDRA-6440)
* Allow per-dc enabling of hints (CASSANDRA-6157)
[5/6] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/85f67aa9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/85f67aa9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/85f67aa9
Branch: refs/heads/cassandra-2.1
Commit: 85f67aa9c647af9353e22bf1b4434e0fa93f23c7
Parents: 47a787a d21c0c9
Author: Brandon Williams <br...@apache.org>
Authored: Tue Feb 25 10:42:11 2014 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Feb 25 10:42:11 2014 -0600
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../locator/DynamicEndpointSnitch.java | 25 +++--
.../locator/DynamicEndpointSnitchTest.java | 108 ++++++++-----------
3 files changed, 61 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/85f67aa9/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index ce5a11d,ee138ce..65ce8c2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,50 -1,5 +1,51 @@@
+2.1.0-beta2
+ * Fix overflow of memtable_total_space_in_mb (CASSANDRA-6573)
+ * Fix ABTC NPE (CASSANDRA-6692)
+ * Allow nodetool to use a file or prompt for password (CASSANDRA-6660)
+ * Fix AIOOBE when concurrently accessing ABSC (CASSANDRA-6742)
+ * Fix assertion error in ALTER TYPE RENAME (CASSANDRA-6705)
+ * Scrub should not always clear out repaired status (CASSANDRA-5351)
+
+2.1.0-beta1
+ * Add flush directory distinct from compaction directories (CASSANDRA-6357)
+ * Require JNA by default (CASSANDRA-6575)
+ * add listsnapshots command to nodetool (CASSANDRA-5742)
+ * Introduce AtomicBTreeColumns (CASSANDRA-6271, 6692)
+ * Multithreaded commitlog (CASSANDRA-3578)
+ * allocate fixed index summary memory pool and resample cold index summaries
+ to use less memory (CASSANDRA-5519)
+ * Removed multithreaded compaction (CASSANDRA-6142)
+ * Parallelize fetching rows for low-cardinality indexes (CASSANDRA-1337)
+ * change logging from log4j to logback (CASSANDRA-5883)
+ * switch to LZ4 compression for internode communication (CASSANDRA-5887)
+ * Stop using Thrift-generated Index* classes internally (CASSANDRA-5971)
+ * Remove 1.2 network compatibility code (CASSANDRA-5960)
+ * Remove leveled json manifest migration code (CASSANDRA-5996)
+ * Remove CFDefinition (CASSANDRA-6253)
+ * Use AtomicIntegerFieldUpdater in RefCountedMemory (CASSANDRA-6278)
+ * User-defined types for CQL3 (CASSANDRA-5590)
+ * Use of o.a.c.metrics in nodetool (CASSANDRA-5871, 6406)
+ * Batch read from OTC's queue and cleanup (CASSANDRA-1632)
+ * Secondary index support for collections (CASSANDRA-4511, 6383)
+ * SSTable metadata(Stats.db) format change (CASSANDRA-6356)
+ * Push composites support in the storage engine
+ (CASSANDRA-5417, CASSANDRA-6520)
+ * Add snapshot space used to cfstats (CASSANDRA-6231)
+ * Add cardinality estimator for key count estimation (CASSANDRA-5906)
+ * CF id is changed to be non-deterministic. Data dir/key cache are created
+ uniquely for CF id (CASSANDRA-5202)
+ * New counters implementation (CASSANDRA-6504)
+ * Replace UnsortedColumns, EmptyColumns, TreeMapBackedSortedColumns with new
+ ArrayBackedSortedColumns (CASSANDRA-6630, CASSANDRA-6662, CASSANDRA-6690)
+ * Add option to use row cache with a given amount of rows (CASSANDRA-5357)
+ * Avoid repairing already repaired data (CASSANDRA-5351)
+ * Reject counter updates with USING TTL/TIMESTAMP (CASSANDRA-6649)
+ * Replace index_interval with min/max_index_interval (CASSANDRA-6379)
+ * Lift limitation that order by columns must be selected for IN queries (CASSANDRA-4911)
+
+
2.0.6
+ * Compare scores of full replica ordering in DES (CASSANDRA-6883)
* fix CME in SessionInfo updateProgress affecting netstats (CASSANDRA-6577)
* Allow repairing between specific replicas (CASSANDRA-6440)
* Allow per-dc enabling of hints (CASSANDRA-6157)
[3/6] git commit: Compare scores of full replica ordering in DES.
Patch by Tyler Hobbs, reviewed by brandonwilliams for CASSANDRA-6883
Posted by br...@apache.org.
Compare scores of full replica ordering in DES.
Patch by Tyler Hobbs, reviewed by brandonwilliams for CASSANDRA-6883
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d21c0c93
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d21c0c93
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d21c0c93
Branch: refs/heads/trunk
Commit: d21c0c932c7d962feb958159578cf2cfb471a648
Parents: cd2c438
Author: Brandon Williams <br...@apache.org>
Authored: Tue Feb 25 10:40:58 2014 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Tue Feb 25 10:42:02 2014 -0600
----------------------------------------------------------------------
CHANGES.txt | 1 +
.../locator/DynamicEndpointSnitch.java | 25 +++--
.../locator/DynamicEndpointSnitchTest.java | 108 ++++++++-----------
3 files changed, 61 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f3a854c..ee138ce 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.6
+ * Compare scores of full replica ordering in DES (CASSANDRA-6883)
* fix CME in SessionInfo updateProgress affecting netstats (CASSANDRA-6577)
* Allow repairing between specific replicas (CASSANDRA-6440)
* Allow per-dc enabling of hints (CASSANDRA-6157)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/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 e9d55d4..00c3618 100644
--- a/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
+++ b/src/java/org/apache/cassandra/locator/DynamicEndpointSnitch.java
@@ -156,16 +156,27 @@ public class DynamicEndpointSnitch extends AbstractEndpointSnitch implements ILa
{
if (addresses.size() < 2)
return;
+
subsnitch.sortByProximity(address, addresses);
- Double first = scores.get(addresses.get(0));
- if (first == null)
- return;
- for (InetAddress addr : addresses)
+ ArrayList<Double> subsnitchOrderedScores = new ArrayList<>(addresses.size());
+ for (InetAddress inet : addresses)
{
- Double next = scores.get(addr);
- if (next == null)
+ Double score = scores.get(inet);
+ if (score == null)
return;
- if ((first - next) / first > BADNESS_THRESHOLD)
+ subsnitchOrderedScores.add(score);
+ }
+
+ // Sort the scores and then compare them (positionally) to the scores in the subsnitch order.
+ // If any of the subsnitch-ordered scores exceed the optimal/sorted score by BADNESS_THRESHOLD, use
+ // the score-sorted ordering instead of the subsnitch ordering.
+ ArrayList<Double> sortedScores = new ArrayList<>(subsnitchOrderedScores);
+ Collections.sort(sortedScores);
+
+ Iterator<Double> sortedScoreIterator = sortedScores.iterator();
+ for (Double subsnitchScore : subsnitchOrderedScores)
+ {
+ if (subsnitchScore > (sortedScoreIterator.next() * (1.0 + BADNESS_THRESHOLD)))
{
sortByProximityWithScore(address, addresses);
return;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d21c0c93/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 dca87a2..e23bcfa 100644
--- a/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
+++ b/test/unit/org/apache/cassandra/locator/DynamicEndpointSnitchTest.java
@@ -21,7 +21,8 @@ package org.apache.cassandra.locator;
import java.io.IOException;
import java.net.InetAddress;
-import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.service.StorageService;
@@ -29,89 +30,64 @@ import org.junit.Test;
import org.apache.cassandra.utils.FBUtilities;
+import static org.junit.Assert.assertEquals;
+
public class DynamicEndpointSnitchTest
{
+
+ private static void setScores(DynamicEndpointSnitch dsnitch, int rounds, List<InetAddress> hosts, Integer... scores) throws InterruptedException
+ {
+ for (int round = 0; round < rounds; round++)
+ {
+ for (int i = 0; i < hosts.size(); i++)
+ dsnitch.receiveTiming(hosts.get(i), scores[i]);
+ }
+ Thread.sleep(150);
+ }
+
@Test
public void testSnitch() throws InterruptedException, IOException, ConfigurationException
{
// do this because SS needs to be initialized before DES can work properly.
StorageService.instance.initClient(0);
- int sleeptime = 150;
SimpleSnitch ss = new SimpleSnitch();
DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch(ss, String.valueOf(ss.hashCode()));
InetAddress self = FBUtilities.getBroadcastAddress();
- ArrayList<InetAddress> order = new ArrayList<InetAddress>();
- InetAddress host1 = InetAddress.getByName("127.0.0.4");
- InetAddress host2 = InetAddress.getByName("127.0.0.2");
- InetAddress host3 = InetAddress.getByName("127.0.0.3");
+ InetAddress host1 = InetAddress.getByName("127.0.0.2");
+ InetAddress host2 = InetAddress.getByName("127.0.0.3");
+ InetAddress host3 = InetAddress.getByName("127.0.0.4");
+ List<InetAddress> hosts = Arrays.asList(host1, host2, host3);
// first, make all hosts equal
- for (int i = 0; i < 5; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- }
-
- Thread.sleep(sleeptime);
-
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 1, hosts, 10, 10, 10);
+ List<InetAddress> order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host1 a little worse
- dsnitch.receiveTiming(host1, 2L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host2);
- order.add(host3);
- order.add(host1);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 1, hosts, 20, 10, 10);
+ order = Arrays.asList(host2, host3, host1);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host2 as bad as host1
- dsnitch.receiveTiming(host2, 2L);
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host3, 1L);
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host3);
- order.add(host1);
- order.add(host2);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 2, hosts, 15, 20, 10);
+ order = Arrays.asList(host3, host1, host2);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host3 the worst
- for (int i = 0; i < 2; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 2L);
- }
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 3, hosts, 10, 10, 30);
+ order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
// make host3 equal to the others
- for (int i = 0; i < 2; i++)
- {
- dsnitch.receiveTiming(host1, 1L);
- dsnitch.receiveTiming(host2, 1L);
- dsnitch.receiveTiming(host3, 1L);
- }
- Thread.sleep(sleeptime);
-
- order.clear();
- order.add(host1);
- order.add(host2);
- order.add(host3);
- assert dsnitch.getSortedListByProximity(self, order).equals(order);
+ setScores(dsnitch, 5, hosts, 10, 10, 10);
+ order = Arrays.asList(host1, host2, host3);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
+
+ /// Tests CASSANDRA-6683 improvements
+ // make the scores differ enough from the ideal order that we sort by score; under the old
+ // dynamic snitch behavior (where we only compared neighbors), these wouldn't get sorted
+ setScores(dsnitch, 20, hosts, 10, 70, 20);
+ order = Arrays.asList(host1, host3, host2);
+ assertEquals(order, dsnitch.getSortedListByProximity(self, Arrays.asList(host1, host2, host3)));
}
-}
+}
\ No newline at end of file