Skip to content

Commit

Permalink
Fix the problems with the RebalanceTest when using the revised
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jayjwylie committed Oct 9, 2012
1 parent 0c2bd87 commit 714cd46
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
32 changes: 27 additions & 5 deletions test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java
Expand Up @@ -273,10 +273,12 @@ public void testRORWRebalance() throws Exception {

// start servers 0 , 1 only
List<Integer> serverList = Arrays.asList(0, 1);
Map<String, String> configProps = new HashMap<String, String>();
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);

Expand All @@ -303,6 +305,7 @@ public void testRORWRebalance() throws Exception {
storeDefWithoutReplication,
rebalanceClient,
Arrays.asList(1));

checkConsistentMetadata(targetCluster, serverList);
} finally {
// stop servers
Expand All @@ -321,7 +324,13 @@ public void testRORWRebalanceWithReplication() throws Exception {

// start servers 0 , 1 only
List<Integer> serverList = Arrays.asList(0, 1);
currentCluster = startServers(currentCluster, storeDefFileWithReplication, serverList, null);
Map<String, String> configProps = new HashMap<String, String>();
configProps.put("admin.max.threads", "50");

currentCluster = startServers(currentCluster,
storeDefFileWithReplication,
serverList,
configProps);
// Update the cluster information based on the node information
targetCluster = updateCluster(targetCluster);

Expand Down Expand Up @@ -365,10 +374,19 @@ public void testRORebalanceWithReplication() throws Exception {

// start servers 0 , 1 only
List<Integer> 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<String, String> configProps = new HashMap<String, String>();
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);

Expand Down Expand Up @@ -772,10 +790,12 @@ public void testProxyGetDuringRebalancing() throws Exception {
Lists.newArrayList(2, 3));
// start servers 0 , 1 only
final List<Integer> serverList = Arrays.asList(0, 1);
Map<String, String> configProps = new HashMap<String, String>();
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);
Expand Down Expand Up @@ -906,10 +926,12 @@ public void testServerSideRouting() throws Exception {
Lists.newArrayList(2, 3));

final List<Integer> serverList = Arrays.asList(0, 1);
Map<String, String> configProps = new HashMap<String, String>();
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);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/voldemort/client/rebalance/RebalanceTest.java
Expand Up @@ -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;
Expand Down

0 comments on commit 714cd46

Please sign in to comment.