From 72758e1345eb19359b4f748cbc819a20085f1061 Mon Sep 17 00:00:00 2001 From: Nelson Ray Date: Mon, 31 Dec 2012 13:55:48 -0800 Subject: [PATCH] update --- .../java/com/metamx/druid/master/BalancerCostAnalyzer.java | 6 +++--- .../com/metamx/druid/master/DruidMasterBalancerTest.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/metamx/druid/master/BalancerCostAnalyzer.java b/server/src/main/java/com/metamx/druid/master/BalancerCostAnalyzer.java index 5ca0bc2aa1c..5bd25ed487a 100644 --- a/server/src/main/java/com/metamx/druid/master/BalancerCostAnalyzer.java +++ b/server/src/main/java/com/metamx/druid/master/BalancerCostAnalyzer.java @@ -45,12 +45,13 @@ public class BalancerCostAnalyzer private static final Logger log = new Logger(BalancerCostAnalyzer.class); private static final int MAX_SEGMENTS_TO_MOVE = 5; private static final int DAY_IN_MILLIS = 1000 * 60 * 60 * 24; - private float initialTotalCost; - private float totalCostChange; private List serverHolderList; private Random rand; + private float initialTotalCost; + private float totalCostChange; + public BalancerCostAnalyzer(){ rand = new Random(0); totalCostChange = 0f; @@ -170,7 +171,6 @@ public class BalancerCostAnalyzer ); totalCostChange += currCost - minPair.lhs; } - } return segmentHoldersToMove; diff --git a/server/src/test/java/com/metamx/druid/master/DruidMasterBalancerTest.java b/server/src/test/java/com/metamx/druid/master/DruidMasterBalancerTest.java index f3b4e8aae1c..ba1b71c8316 100644 --- a/server/src/test/java/com/metamx/druid/master/DruidMasterBalancerTest.java +++ b/server/src/test/java/com/metamx/druid/master/DruidMasterBalancerTest.java @@ -184,5 +184,6 @@ public class DruidMasterBalancerTest 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("costChange").get("normal").get() > 0); } }