mirror of https://github.com/apache/druid.git
fixed issue with web console. Cleaned up code
This commit is contained in:
parent
fc5e15f72b
commit
01db89ac6e
|
@ -22,5 +22,5 @@ import org.joda.time.DateTime;
|
|||
|
||||
public interface BalancerStrategyFactory
|
||||
{
|
||||
public BalancerStrategy getBalancerStrategy(DateTime referenceTimestamp);
|
||||
public BalancerStrategy createBalancerStrategy(DateTime referenceTimestamp);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CostBalancerStrategyFactory implements BalancerStrategyFactory
|
|||
{
|
||||
|
||||
@Override
|
||||
public BalancerStrategy getBalancerStrategy(DateTime referenceTimestamp)
|
||||
public BalancerStrategy createBalancerStrategy(DateTime referenceTimestamp)
|
||||
{
|
||||
return new CostBalancerStrategy(referenceTimestamp);
|
||||
}
|
||||
|
|
|
@ -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 :
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -63,6 +63,7 @@ public class MasterSegmentSettings
|
|||
return mergeBytesLimit;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public boolean isEmitBalancingStats()
|
||||
{
|
||||
return emitBalancingStats;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue