public class RandomBalancerStrategy extends Object implements BalancerStrategy
| Constructor and Description |
|---|
RandomBalancerStrategy() |
| Modifier and Type | Method and Description |
|---|---|
void |
emitStats(String tier,
CoordinatorStats stats,
List<ServerHolder> serverHolderList)
Add balancing strategy stats during the 'balanceTier' operation of
BalanceSegments to be included |
ServerHolder |
findNewSegmentHomeBalancer(DataSegment proposalSegment,
List<ServerHolder> serverHolders)
Find the best server to move a
DataSegment to according the the balancing strategy. |
ServerHolder |
findNewSegmentHomeReplicator(DataSegment proposalSegment,
List<ServerHolder> serverHolders)
Find the best server on which to place a
DataSegment replica according to the balancing strategy |
BalancerSegmentHolder |
pickSegmentToMove(List<ServerHolder> serverHolders,
Set<String> broadcastDatasources)
Pick the best segment to move from one of the supplied set of servers according to the balancing strategy.
|
Iterator<ServerHolder> |
pickServersToDrop(DataSegment toDropSegment,
NavigableSet<ServerHolder> serverHolders)
Returns an iterator for a set of servers to drop from, ordered by preference of which server to drop from first
for a given drop strategy.
|
public ServerHolder findNewSegmentHomeReplicator(DataSegment proposalSegment, List<ServerHolder> serverHolders)
BalancerStrategyDataSegment replica according to the balancing strategyfindNewSegmentHomeReplicator in interface BalancerStrategyproposalSegment - segment to replicateserverHolders - servers to consider as replica holderspublic ServerHolder findNewSegmentHomeBalancer(DataSegment proposalSegment, List<ServerHolder> serverHolders)
BalancerStrategyDataSegment to according the the balancing strategy.findNewSegmentHomeBalancer in interface BalancerStrategyproposalSegment - segment to moveserverHolders - servers to consider as move destinationspublic BalancerSegmentHolder pickSegmentToMove(List<ServerHolder> serverHolders, Set<String> broadcastDatasources)
BalancerStrategypickSegmentToMove in interface BalancerStrategyserverHolders - set of historicals to consider for moving segmentsbroadcastDatasources - Datasources that contain segments which were loaded via broadcast rules.
Balancing strategies should avoid rebalancing segments for such datasources, since
they should be loaded on all servers anyway.
NOTE: this should really be handled on a per-segment basis, to properly support
the interval or period-based broadcast rules. For simplicity of the initial
implementation, only forever broadcast rules are supported.BalancerSegmentHolder containing segment to move and server it currently resides on, or null if
there are no segments to pick from (i. e. all provided serverHolders are empty).public Iterator<ServerHolder> pickServersToDrop(DataSegment toDropSegment, NavigableSet<ServerHolder> serverHolders)
BalancerStrategypickServersToDrop in interface BalancerStrategytoDropSegment - segment to drop from one or more serversserverHolders - set of historicals to consider dropping frompublic void emitStats(String tier, CoordinatorStats stats, List<ServerHolder> serverHolderList)
BalancerStrategyBalanceSegments to be includedemitStats in interface BalancerStrategytier - historical tier being balancedstats - stats object to add balancing strategy stats toserverHolderList - servers in tier being balancedCopyright © 2011–2020 The Apache Software Foundation. All rights reserved.