This commit is contained in:
Nelson Ray 2012-12-31 13:55:48 -08:00
parent 3eda9dc5f2
commit 72758e1345
2 changed files with 4 additions and 3 deletions

View File

@ -45,12 +45,13 @@ public class BalancerCostAnalyzer
private static final Logger log = new Logger(BalancerCostAnalyzer.class); private static final Logger log = new Logger(BalancerCostAnalyzer.class);
private static final int MAX_SEGMENTS_TO_MOVE = 5; private static final int MAX_SEGMENTS_TO_MOVE = 5;
private static final int DAY_IN_MILLIS = 1000 * 60 * 60 * 24; private static final int DAY_IN_MILLIS = 1000 * 60 * 60 * 24;
private float initialTotalCost;
private float totalCostChange;
private List<ServerHolder> serverHolderList; private List<ServerHolder> serverHolderList;
private Random rand; private Random rand;
private float initialTotalCost;
private float totalCostChange;
public BalancerCostAnalyzer(){ public BalancerCostAnalyzer(){
rand = new Random(0); rand = new Random(0);
totalCostChange = 0f; totalCostChange = 0f;
@ -170,7 +171,6 @@ public class BalancerCostAnalyzer
); );
totalCostChange += currCost - minPair.lhs; totalCostChange += currCost - minPair.lhs;
} }
} }
return segmentHoldersToMove; return segmentHoldersToMove;

View File

@ -184,5 +184,6 @@ public class DruidMasterBalancerTest
params = new DruidMasterBalancer(master, new BalancerCostAnalyzer()).run(params); params = new DruidMasterBalancer(master, new BalancerCostAnalyzer()).run(params);
Assert.assertTrue(params.getMasterStats().getPerTierStats().get("movedCount").get("normal").get() > 0); Assert.assertTrue(params.getMasterStats().getPerTierStats().get("movedCount").get("normal").get() > 0);
Assert.assertTrue(params.getMasterStats().getPerTierStats().get("costChange").get("normal").get() > 0);
} }
} }