From 714cd46f41c0b8ee00f761bcdee662666ad26ae0 Mon Sep 17 00:00:00 2001 From: Jay J Wylie Date: Tue, 11 Sep 2012 11:04:20 -0700 Subject: [PATCH] Fix the problems with the RebalanceTest when using the revised KeyedResourcePool. The test setup worked before the changes because the KeyedResourcePool did not aquire resources until full. With the new behavior, there is some mismatch between pool sizes and numbers of threads. Increasing the number of admin threads fixes the issue. There may be a better way of fixing this problem. --- .../rebalance/AbstractRebalanceTest.java | 32 ++++++++++++++++--- .../client/rebalance/RebalanceTest.java | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java b/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java index a6be44b7c2..6bf574934d 100644 --- a/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java +++ b/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java @@ -273,10 +273,12 @@ public void testRORWRebalance() throws Exception { // start servers 0 , 1 only List serverList = Arrays.asList(0, 1); + Map configProps = new HashMap(); + configProps.put("admin.max.threads", "50"); currentCluster = startServers(currentCluster, storeDefFileWithoutReplication, serverList, - null); + configProps); // Update the cluster information based on the node information targetCluster = updateCluster(targetCluster); @@ -303,6 +305,7 @@ public void testRORWRebalance() throws Exception { storeDefWithoutReplication, rebalanceClient, Arrays.asList(1)); + checkConsistentMetadata(targetCluster, serverList); } finally { // stop servers @@ -321,7 +324,13 @@ public void testRORWRebalanceWithReplication() throws Exception { // start servers 0 , 1 only List serverList = Arrays.asList(0, 1); - currentCluster = startServers(currentCluster, storeDefFileWithReplication, serverList, null); + Map configProps = new HashMap(); + configProps.put("admin.max.threads", "50"); + + currentCluster = startServers(currentCluster, + storeDefFileWithReplication, + serverList, + configProps); // Update the cluster information based on the node information targetCluster = updateCluster(targetCluster); @@ -365,10 +374,19 @@ public void testRORebalanceWithReplication() throws Exception { // start servers 0 , 1 only List serverList = Arrays.asList(0, 1); + + // TODO: Why does increasing the number of admin threads make the tests + // run? Without this increase, the RejectedExecutionHandler in + // SocketServer.java fires with an error message like the following: + // "[18:46:32,994 voldemort.server.socket.SocketServer[admin-server]] + // ERROR Too many open connections, 20 of 20 threads in use, denying + // connection from /127.0.0.1:43756 [Thread-552]" + Map configProps = new HashMap(); + configProps.put("admin.max.threads", "50"); currentCluster = startServers(currentCluster, roStoreDefFileWithReplication, serverList, - null); + configProps); // Update the cluster information based on the node information targetCluster = updateCluster(targetCluster); @@ -772,10 +790,12 @@ public void testProxyGetDuringRebalancing() throws Exception { Lists.newArrayList(2, 3)); // start servers 0 , 1 only final List serverList = Arrays.asList(0, 1); + Map configProps = new HashMap(); + configProps.put("admin.max.threads", "50"); final Cluster updatedCurrentCluster = startServers(currentCluster, storeDefFileWithReplication, serverList, - null); + configProps); final Cluster updatedTargetCluster = updateCluster(targetCluster); ExecutorService executors = Executors.newFixedThreadPool(2); @@ -906,10 +926,12 @@ public void testServerSideRouting() throws Exception { Lists.newArrayList(2, 3)); final List serverList = Arrays.asList(0, 1); + Map configProps = new HashMap(); + configProps.put("admin.max.threads", "50"); final Cluster updatedCurrentCluster = startServers(currentCluster, storeDefFileWithReplication, serverList, - null); + configProps); final Cluster updatedTargetCluster = updateCluster(targetCluster); ExecutorService executors = Executors.newFixedThreadPool(2); diff --git a/test/unit/voldemort/client/rebalance/RebalanceTest.java b/test/unit/voldemort/client/rebalance/RebalanceTest.java index 9d3f223398..5efe755213 100644 --- a/test/unit/voldemort/client/rebalance/RebalanceTest.java +++ b/test/unit/voldemort/client/rebalance/RebalanceTest.java @@ -6,8 +6,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Properties; import java.util.Map.Entry; +import java.util.Properties; import org.junit.runner.RunWith; import org.junit.runners.Parameterized;