diff --git a/server/src/main/java/com/metamx/druid/master/BalancerStrategyFactory.java b/server/src/main/java/com/metamx/druid/master/BalancerStrategyFactory.java index 982d23c887d..c215c1b39a9 100644 --- a/server/src/main/java/com/metamx/druid/master/BalancerStrategyFactory.java +++ b/server/src/main/java/com/metamx/druid/master/BalancerStrategyFactory.java @@ -22,5 +22,5 @@ import org.joda.time.DateTime; public interface BalancerStrategyFactory { - public BalancerStrategy getBalancerStrategy(DateTime referenceTimestamp); + public BalancerStrategy createBalancerStrategy(DateTime referenceTimestamp); } diff --git a/server/src/main/java/com/metamx/druid/master/CostBalancerStrategyFactory.java b/server/src/main/java/com/metamx/druid/master/CostBalancerStrategyFactory.java index 5acb634ce8d..76e315b1625 100644 --- a/server/src/main/java/com/metamx/druid/master/CostBalancerStrategyFactory.java +++ b/server/src/main/java/com/metamx/druid/master/CostBalancerStrategyFactory.java @@ -24,7 +24,7 @@ public class CostBalancerStrategyFactory implements BalancerStrategyFactory { @Override - public BalancerStrategy getBalancerStrategy(DateTime referenceTimestamp) + public BalancerStrategy createBalancerStrategy(DateTime referenceTimestamp) { return new CostBalancerStrategy(referenceTimestamp); } diff --git a/server/src/main/java/com/metamx/druid/master/DruidMasterBalancer.java b/server/src/main/java/com/metamx/druid/master/DruidMasterBalancer.java index 889383a8054..bb547bae8d8 100644 --- a/server/src/main/java/com/metamx/druid/master/DruidMasterBalancer.java +++ b/server/src/main/java/com/metamx/druid/master/DruidMasterBalancer.java @@ -78,7 +78,7 @@ public class DruidMasterBalancer implements DruidMasterHelper { final MasterStats stats = new MasterStats(); final DateTime referenceTimestamp = params.getBalancerReferenceTimestamp(); - final BalancerStrategy strategy = params.getBalancerStrategyFactory().getBalancerStrategy(referenceTimestamp); + final BalancerStrategy strategy = params.getBalancerStrategyFactory().createBalancerStrategy(referenceTimestamp); final int maxSegmentsToMove = params.getMasterSegmentSettings().getMaxSegmentsToMove(); for (Map.Entry> entry : diff --git a/server/src/main/java/com/metamx/druid/master/DruidMasterConfig.java b/server/src/main/java/com/metamx/druid/master/DruidMasterConfig.java index 95b5c8db666..3e2b2719870 100644 --- a/server/src/main/java/com/metamx/druid/master/DruidMasterConfig.java +++ b/server/src/main/java/com/metamx/druid/master/DruidMasterConfig.java @@ -64,12 +64,6 @@ public abstract class DruidMasterConfig @Default("15") public abstract int getReplicantLifetime(); - @Config("druid.master.masterSegmentSettings") - public MasterSegmentSettings getMasterSegmentSettings() - { - return new MasterSegmentSettings.Builder().build(); - } - @Config("druid.master.replicant.throttleLimit") @Default("10") public abstract int getReplicantThrottleLimit(); diff --git a/server/src/main/java/com/metamx/druid/master/DruidMasterRuntimeParams.java b/server/src/main/java/com/metamx/druid/master/DruidMasterRuntimeParams.java index 4ad153cefe7..0dfe9afca4f 100644 --- a/server/src/main/java/com/metamx/druid/master/DruidMasterRuntimeParams.java +++ b/server/src/main/java/com/metamx/druid/master/DruidMasterRuntimeParams.java @@ -190,7 +190,6 @@ public class DruidMasterRuntimeParams private MasterSegmentSettings masterSegmentSettings; private MasterStats stats; private DateTime balancerReferenceTimestamp; - private boolean emitBalancingCostParams; private BalancerStrategyFactory strategyFactory; Builder() @@ -207,7 +206,6 @@ public class DruidMasterRuntimeParams this.stats = new MasterStats(); this.masterSegmentSettings = new MasterSegmentSettings.Builder().build(); this.balancerReferenceTimestamp = null; - this.emitBalancingCostParams = false; this.strategyFactory = new CostBalancerStrategyFactory(); } @@ -239,7 +237,6 @@ public class DruidMasterRuntimeParams this.masterSegmentSettings = masterSegmentSettings; this.stats = stats; this.balancerReferenceTimestamp = balancerReferenceTimestamp; - this.emitBalancingCostParams = emitBalancingCostParams; this.strategyFactory=strategyFactory; } @@ -262,18 +259,6 @@ public class DruidMasterRuntimeParams ); } - public Builder withBalancerStrategy(BalancerStrategyFactory strategyFactory) - { - this.strategyFactory = strategyFactory; - return this; - } - - public Builder withEmitBalancingCostParams(boolean param) - { - emitBalancingCostParams = param; - return this; - } - public Builder withStartTime(long time) { startTime = time; diff --git a/server/src/main/java/com/metamx/druid/master/MasterSegmentSettings.java b/server/src/main/java/com/metamx/druid/master/MasterSegmentSettings.java index 75a56fa9cb7..1bafb38ecc8 100644 --- a/server/src/main/java/com/metamx/druid/master/MasterSegmentSettings.java +++ b/server/src/main/java/com/metamx/druid/master/MasterSegmentSettings.java @@ -63,6 +63,7 @@ public class MasterSegmentSettings return mergeBytesLimit; } + @JsonProperty public boolean isEmitBalancingStats() { return emitBalancingStats; diff --git a/server/src/main/java/com/metamx/druid/master/RandomBalancerStrategyFactory.java b/server/src/main/java/com/metamx/druid/master/RandomBalancerStrategyFactory.java index 0cce3a11d3d..1994c0a5fea 100644 --- a/server/src/main/java/com/metamx/druid/master/RandomBalancerStrategyFactory.java +++ b/server/src/main/java/com/metamx/druid/master/RandomBalancerStrategyFactory.java @@ -23,7 +23,7 @@ import org.joda.time.DateTime; public class RandomBalancerStrategyFactory implements BalancerStrategyFactory { @Override - public BalancerStrategy getBalancerStrategy(DateTime referenceTimestamp) + public BalancerStrategy createBalancerStrategy(DateTime referenceTimestamp) { return new RandomBalancerStrategy(); } diff --git a/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java b/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java index 64aa3dfaff0..b133af1799e 100644 --- a/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java +++ b/server/src/main/java/com/metamx/druid/master/rules/LoadRule.java @@ -60,7 +60,7 @@ public abstract class LoadRule implements Rule final List serverHolderList = new ArrayList(serverQueue); final DateTime referenceTimestamp = params.getBalancerReferenceTimestamp(); - final BalancerStrategy strategy = params.getBalancerStrategyFactory().getBalancerStrategy(referenceTimestamp); + final BalancerStrategy strategy = params.getBalancerStrategyFactory().createBalancerStrategy(referenceTimestamp); if (params.getAvailableSegments().contains(segment)) { stats.accumulate( assign( diff --git a/server/src/main/resources/static/js/masterSegmentSettings.js b/server/src/main/resources/static/js/masterSegmentSettings.js index b992cc8cf19..832859d97e1 100644 --- a/server/src/main/resources/static/js/masterSegmentSettings.js +++ b/server/src/main/resources/static/js/masterSegmentSettings.js @@ -4,6 +4,7 @@ $(function () { document.getElementById("mergeBytes").value = data["mergeBytesLimit"]; document.getElementById("mergeSegments").value = data["mergeSegmentsLimit"]; document.getElementById("maxSegments").value = data["maxSegmentsToMove"]; + document.getElementById("emitBalancingStats").value = data["emitBalancingStats"]; }); $("#submit").click( function () diff --git a/server/src/main/resources/static/masterSegmentSettings.html b/server/src/main/resources/static/masterSegmentSettings.html index c4f06ec25db..4306305d252 100644 --- a/server/src/main/resources/static/masterSegmentSettings.html +++ b/server/src/main/resources/static/masterSegmentSettings.html @@ -13,6 +13,7 @@
maxSegmentsToMove:
+ emitBalancingStats: diff --git a/server/src/test/java/com/metamx/druid/master/DruidMasterTest.java b/server/src/test/java/com/metamx/druid/master/DruidMasterTest.java index 59b727d1355..80993ed62f2 100644 --- a/server/src/test/java/com/metamx/druid/master/DruidMasterTest.java +++ b/server/src/test/java/com/metamx/druid/master/DruidMasterTest.java @@ -100,12 +100,6 @@ public class DruidMasterTest return ""; } - @Override - public MasterSegmentSettings getMasterSegmentSettings() - { - return new MasterSegmentSettings.Builder().withMillisToWaitBeforeDeleting(super.getMasterSegmentSettings().getMillisToWaitBeforeDeleting()).withMaxSegmentsToMove(0).build(); - } - @Override public int getReplicantLifetime() {