From b8e6f784abe0d13930196f5189e848d445f5c3d5 Mon Sep 17 00:00:00 2001 From: Vinoth Chandar Date: Fri, 12 Apr 2013 16:49:39 -0700 Subject: [PATCH] Forklift tool fix to equally spread fetches --- src/java/voldemort/utils/ClusterForkLiftTool.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/java/voldemort/utils/ClusterForkLiftTool.java b/src/java/voldemort/utils/ClusterForkLiftTool.java index 67a7e42538..5f98e36aae 100644 --- a/src/java/voldemort/utils/ClusterForkLiftTool.java +++ b/src/java/voldemort/utils/ClusterForkLiftTool.java @@ -1,6 +1,7 @@ package voldemort.utils; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -160,6 +161,9 @@ public ClusterForkLiftTool(String srcBootstrapUrl, .getNumberOfPartitions()); for(Node node: srcAdminClient.getAdminClientCluster().getNodes()) this.partitionList.addAll(node.getPartitionIds()); + // shuffle the partition list so the fetching will equally spread + // across the source cluster + Collections.shuffle(this.partitionList); if(this.partitionList.size() > srcAdminClient.getAdminClientCluster() .getNumberOfPartitions()) { throw new VoldemortException("Incorrect partition mapping in source cluster"); @@ -557,7 +561,7 @@ public static void main(String[] args) throws Exception { maxPutsPerSecond = (Integer) options.valueOf("max-puts-per-second"); List storesList = null; if(options.has("stores")) { - storesList = (List) options.valuesOf("stores"); + storesList = new ArrayList((List) options.valuesOf("stores")); } List partitions = null; if(options.has("partitions")) {