mirror of https://github.com/apache/druid.git
Dynamic Config
This commit is contained in:
parent
5af414c93c
commit
bec264bdf7
|
@ -31,6 +31,7 @@ public class CoordinatorDynamicConfig
|
|||
private final int maxSegmentsToMove;
|
||||
private final int replicantLifetime;
|
||||
private final int replicationThrottleLimit;
|
||||
private final int costBalancerThreads;
|
||||
private final boolean emitBalancingStats;
|
||||
|
||||
@JsonCreator
|
||||
|
@ -41,6 +42,7 @@ public class CoordinatorDynamicConfig
|
|||
@JsonProperty("maxSegmentsToMove") int maxSegmentsToMove,
|
||||
@JsonProperty("replicantLifetime") int replicantLifetime,
|
||||
@JsonProperty("replicationThrottleLimit") int replicationThrottleLimit,
|
||||
@JsonProperty("costBalancerThreads") int costBalancerThreads,
|
||||
@JsonProperty("emitBalancingStats") boolean emitBalancingStats
|
||||
)
|
||||
{
|
||||
|
@ -51,6 +53,7 @@ public class CoordinatorDynamicConfig
|
|||
this.replicantLifetime = replicantLifetime;
|
||||
this.replicationThrottleLimit = replicationThrottleLimit;
|
||||
this.emitBalancingStats = emitBalancingStats;
|
||||
this.costBalancerThreads = costBalancerThreads;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
|
@ -95,6 +98,12 @@ public class CoordinatorDynamicConfig
|
|||
return replicationThrottleLimit;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public int getCostBalancerThreads()
|
||||
{
|
||||
return costBalancerThreads;
|
||||
}
|
||||
|
||||
public static class Builder
|
||||
{
|
||||
private long millisToWaitBeforeDeleting;
|
||||
|
@ -104,10 +113,11 @@ public class CoordinatorDynamicConfig
|
|||
private int replicantLifetime;
|
||||
private int replicationThrottleLimit;
|
||||
private boolean emitBalancingStats;
|
||||
private int costBalancerThreads;
|
||||
|
||||
public Builder()
|
||||
{
|
||||
this(15 * 60 * 1000L, 100000000L, Integer.MAX_VALUE, 5, 15, 10, false);
|
||||
this(15 * 60 * 1000L, 100000000L, Integer.MAX_VALUE, 5, 15, 10, 1, false);
|
||||
}
|
||||
|
||||
private Builder(
|
||||
|
@ -117,6 +127,7 @@ public class CoordinatorDynamicConfig
|
|||
int maxSegmentsToMove,
|
||||
int replicantLifetime,
|
||||
int replicationThrottleLimit,
|
||||
int costBalancerThreads,
|
||||
boolean emitBalancingStats
|
||||
)
|
||||
{
|
||||
|
@ -127,6 +138,7 @@ public class CoordinatorDynamicConfig
|
|||
this.replicantLifetime = replicantLifetime;
|
||||
this.replicationThrottleLimit = replicationThrottleLimit;
|
||||
this.emitBalancingStats = emitBalancingStats;
|
||||
this.costBalancerThreads = costBalancerThreads;
|
||||
}
|
||||
|
||||
public Builder withMillisToWaitBeforeDeleting(long millisToWaitBeforeDeleting)
|
||||
|
@ -165,6 +177,12 @@ public class CoordinatorDynamicConfig
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder withCostBalancerThreads(int costBalancerThreads)
|
||||
{
|
||||
this.costBalancerThreads = costBalancerThreads;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CoordinatorDynamicConfig build()
|
||||
{
|
||||
return new CoordinatorDynamicConfig(
|
||||
|
@ -174,6 +192,7 @@ public class CoordinatorDynamicConfig
|
|||
maxSegmentsToMove,
|
||||
replicantLifetime,
|
||||
replicationThrottleLimit,
|
||||
costBalancerThreads,
|
||||
emitBalancingStats
|
||||
);
|
||||
}
|
||||
|
|
|
@ -745,7 +745,7 @@ public class DruidCoordinator
|
|||
else if (RANDOM.equals(config.getCoordinatorBalancerStrategy()))
|
||||
factory= new RandomBalancerStrategyFactory();
|
||||
else if (COST_MULTI.equals(config.getCoordinatorBalancerStrategy()))
|
||||
factory = new CostBalancerMultithreadStrategyFactory(config.getCostBalancerStrategyThreadCount());
|
||||
factory = new CostBalancerMultithreadStrategyFactory(getDynamicConfigs().getCostBalancerThreads());
|
||||
|
||||
// Do coordinator stuff.
|
||||
DruidCoordinatorRuntimeParams params =
|
||||
|
|
|
@ -46,10 +46,6 @@ public abstract class DruidCoordinatorConfig
|
|||
@Default("cost")
|
||||
public abstract String getCoordinatorBalancerStrategy();
|
||||
|
||||
@Config("druid.coordinator.cost.balancer.threads")
|
||||
@Default("4")
|
||||
public abstract int getCostBalancerStrategyThreadCount();
|
||||
|
||||
@Config("druid.coordinator.merge.on")
|
||||
public boolean isMergeSegments()
|
||||
{
|
||||
|
|
|
@ -102,11 +102,6 @@ public class DruidCoordinatorTest
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostBalancerStrategyThreadCount()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
},
|
||||
new ZkPathsConfig(){
|
||||
|
||||
|
|
Loading…
Reference in New Issue