fixed issue with web console. Cleaned up code

This commit is contained in:
Dhruv Parthasarathy 2013-08-09 00:33:40 -07:00
parent fc5e15f72b
commit 01db89ac6e
11 changed files with 8 additions and 32 deletions

View File

@ -22,5 +22,5 @@ import org.joda.time.DateTime;
public interface BalancerStrategyFactory
{
public BalancerStrategy getBalancerStrategy(DateTime referenceTimestamp);
public BalancerStrategy createBalancerStrategy(DateTime referenceTimestamp);
}

View File

@ -24,7 +24,7 @@ public class CostBalancerStrategyFactory implements BalancerStrategyFactory
{
@Override
public BalancerStrategy getBalancerStrategy(DateTime referenceTimestamp)
public BalancerStrategy createBalancerStrategy(DateTime referenceTimestamp)
{
return new CostBalancerStrategy(referenceTimestamp);
}

View File

@ -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<String, MinMaxPriorityQueue<ServerHolder>> entry :

View File

@ -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();

View File

@ -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;

View File

@ -63,6 +63,7 @@ public class MasterSegmentSettings
return mergeBytesLimit;
}
@JsonProperty
public boolean isEmitBalancingStats()
{
return emitBalancingStats;

View File

@ -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();
}

View File

@ -60,7 +60,7 @@ public abstract class LoadRule implements Rule
final List<ServerHolder> serverHolderList = new ArrayList<ServerHolder>(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(

View File

@ -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 ()

View File

@ -13,6 +13,7 @@
<br>
maxSegmentsToMove: <input type= "text" name ="maxSegmentsToMove" id ="maxSegments">
<br>
emitBalancingStats: <input type= "text" name ="emitBalancingStats" id="emitBalancingStats">
<button type="button" id="submit"> Submit </button>
</form>
</body>

View File

@ -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()
{