mirror of https://github.com/apache/druid.git
minor changes from review
This commit is contained in:
parent
5d729570c1
commit
a049188d23
|
@ -33,11 +33,11 @@ public abstract class AbstractCostBalancerStrategy implements BalancerStrategy
|
|||
private static final int DAY_IN_MILLIS = 1000 * 60 * 60 * 24;
|
||||
private static final int SEVEN_DAYS_IN_MILLIS = 7 * DAY_IN_MILLIS;
|
||||
private static final int THIRTY_DAYS_IN_MILLIS = 30 * DAY_IN_MILLIS;
|
||||
private final long referenceTimestampInMillis;
|
||||
private final long referenceTimestamp;
|
||||
|
||||
public AbstractCostBalancerStrategy(DateTime referenceTimestamp)
|
||||
{
|
||||
this.referenceTimestampInMillis = referenceTimestamp.getMillis();
|
||||
this.referenceTimestamp = referenceTimestamp.getMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,8 +103,8 @@ public abstract class AbstractCostBalancerStrategy implements BalancerStrategy
|
|||
dataSourcePenalty = 2;
|
||||
}
|
||||
|
||||
double segment1diff = referenceTimestampInMillis - segment1.getInterval().getEndMillis();
|
||||
double segment2diff = referenceTimestampInMillis - segment2.getInterval().getEndMillis();
|
||||
double segment1diff = referenceTimestamp - segment1.getInterval().getEndMillis();
|
||||
double segment2diff = referenceTimestamp - segment2.getInterval().getEndMillis();
|
||||
if (segment1diff < SEVEN_DAYS_IN_MILLIS && segment2diff < SEVEN_DAYS_IN_MILLIS) {
|
||||
recencyPenalty = (2 - segment1diff / SEVEN_DAYS_IN_MILLIS) * (2 - segment2diff / SEVEN_DAYS_IN_MILLIS);
|
||||
}
|
||||
|
|
|
@ -25,12 +25,6 @@ import java.util.List;
|
|||
|
||||
public interface BalancerStrategy
|
||||
{
|
||||
public static final String COST = "cost";
|
||||
|
||||
public static final String COST_MULTI = "cost_multi";
|
||||
|
||||
public static final String RANDOM = "random";
|
||||
|
||||
public ServerHolder findNewSegmentHomeBalancer(final DataSegment proposalSegment, final List<ServerHolder> serverHolders);
|
||||
|
||||
public ServerHolder findNewSegmentHomeReplicator(final DataSegment proposalSegment, final List<ServerHolder> serverHolders);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CoordinatorDynamicConfig
|
|||
private final int maxSegmentsToMove;
|
||||
private final int replicantLifetime;
|
||||
private final int replicationThrottleLimit;
|
||||
private final int costBalancerThreads;
|
||||
private final int balancerComputeThreads;
|
||||
private final boolean emitBalancingStats;
|
||||
|
||||
@JsonCreator
|
||||
|
@ -42,7 +42,7 @@ public class CoordinatorDynamicConfig
|
|||
@JsonProperty("maxSegmentsToMove") int maxSegmentsToMove,
|
||||
@JsonProperty("replicantLifetime") int replicantLifetime,
|
||||
@JsonProperty("replicationThrottleLimit") int replicationThrottleLimit,
|
||||
@JsonProperty("costBalancerThreads") int costBalancerThreads,
|
||||
@JsonProperty("balancerComputeThreads") int balancerComputeThreads,
|
||||
@JsonProperty("emitBalancingStats") boolean emitBalancingStats
|
||||
)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ public class CoordinatorDynamicConfig
|
|||
this.replicantLifetime = replicantLifetime;
|
||||
this.replicationThrottleLimit = replicationThrottleLimit;
|
||||
this.emitBalancingStats = emitBalancingStats;
|
||||
this.costBalancerThreads = costBalancerThreads;
|
||||
this.balancerComputeThreads = balancerComputeThreads;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
|
@ -99,9 +99,9 @@ public class CoordinatorDynamicConfig
|
|||
}
|
||||
|
||||
@JsonProperty
|
||||
public int getCostBalancerThreads()
|
||||
public int getBalancerComputeThreads()
|
||||
{
|
||||
return costBalancerThreads;
|
||||
return balancerComputeThreads;
|
||||
}
|
||||
|
||||
public static class Builder
|
||||
|
@ -113,7 +113,7 @@ public class CoordinatorDynamicConfig
|
|||
private int replicantLifetime;
|
||||
private int replicationThrottleLimit;
|
||||
private boolean emitBalancingStats;
|
||||
private int costBalancerThreads;
|
||||
private int balancerComputeThreads;
|
||||
|
||||
public Builder()
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ public class CoordinatorDynamicConfig
|
|||
int maxSegmentsToMove,
|
||||
int replicantLifetime,
|
||||
int replicationThrottleLimit,
|
||||
int costBalancerThreads,
|
||||
int balancerComputeThreads,
|
||||
boolean emitBalancingStats
|
||||
)
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ public class CoordinatorDynamicConfig
|
|||
this.replicantLifetime = replicantLifetime;
|
||||
this.replicationThrottleLimit = replicationThrottleLimit;
|
||||
this.emitBalancingStats = emitBalancingStats;
|
||||
this.costBalancerThreads = costBalancerThreads;
|
||||
this.balancerComputeThreads = balancerComputeThreads;
|
||||
}
|
||||
|
||||
public Builder withMillisToWaitBeforeDeleting(long millisToWaitBeforeDeleting)
|
||||
|
@ -177,9 +177,9 @@ public class CoordinatorDynamicConfig
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder withCostBalancerThreads(int costBalancerThreads)
|
||||
public Builder withBalancerComputeThreads(int balancerComputeThreads)
|
||||
{
|
||||
this.costBalancerThreads = costBalancerThreads;
|
||||
this.balancerComputeThreads = balancerComputeThreads;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ public class CoordinatorDynamicConfig
|
|||
maxSegmentsToMove,
|
||||
replicantLifetime,
|
||||
replicationThrottleLimit,
|
||||
costBalancerThreads,
|
||||
balancerComputeThreads,
|
||||
emitBalancingStats
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
|
||||
package io.druid.server.coordinator;
|
||||
|
||||
import static io.druid.server.coordinator.BalancerStrategy.COST;
|
||||
import static io.druid.server.coordinator.BalancerStrategy.COST_MULTI;
|
||||
import static io.druid.server.coordinator.BalancerStrategy.RANDOM;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Throwables;
|
||||
|
@ -740,7 +737,7 @@ public class DruidCoordinator
|
|||
}
|
||||
|
||||
BalancerStrategyFactory factory =
|
||||
new CostBalancerMultithreadStrategyFactory(getDynamicConfigs().getCostBalancerThreads());
|
||||
new CostBalancerMultithreadStrategyFactory(getDynamicConfigs().getBalancerComputeThreads());
|
||||
|
||||
// Do coordinator stuff.
|
||||
DruidCoordinatorRuntimeParams params =
|
||||
|
|
|
@ -42,10 +42,6 @@ public abstract class DruidCoordinatorConfig
|
|||
@Default("PT1800s")
|
||||
public abstract Duration getCoordinatorIndexingPeriod();
|
||||
|
||||
@Config("druid.coordinator.balancer.strategy")
|
||||
@Default("cost")
|
||||
public abstract String getCoordinatorBalancerStrategy();
|
||||
|
||||
@Config("druid.coordinator.merge.on")
|
||||
public boolean isMergeSegments()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue