public class AllocationService extends AbstractComponent
AllocationService
keeps AllocationDeciders
to choose nodes
for shard allocation. This class also manages new nodes joining the cluster
and rerouting of shards.Modifier and Type | Class and Description |
---|---|
static class |
AllocationService.CommandsResult
this class is used to describe results of applying a set of
AllocationCommand |
deprecationLogger, logger, settings
Constructor and Description |
---|
AllocationService(Settings settings,
AllocationDeciders allocationDeciders,
GatewayAllocator gatewayAllocator,
ShardsAllocator shardsAllocator,
ClusterInfoService clusterInfoService) |
Modifier and Type | Method and Description |
---|---|
ClusterState |
applyFailedShard(ClusterState clusterState,
ShardRouting failedShard) |
ClusterState |
applyFailedShards(ClusterState clusterState,
java.util.List<FailedShard> failedShards) |
ClusterState |
applyFailedShards(ClusterState clusterState,
java.util.List<FailedShard> failedShards,
java.util.List<StaleShard> staleShards)
Applies the failed shards.
|
ClusterState |
applyStartedShards(ClusterState clusterState,
java.util.List<ShardRouting> startedShards)
Applies the started shards.
|
protected ClusterState |
buildResultAndLogHealthChange(ClusterState oldState,
RoutingAllocation allocation,
java.lang.String reason) |
protected long |
currentNanoTime()
override this to control time based decisions during allocation
|
ClusterState |
deassociateDeadNodes(ClusterState clusterState,
boolean reroute,
java.lang.String reason)
unassigned an shards that are associated with nodes that are no longer part of the cluster, potentially promoting replicas
if needed.
|
AllocationService.CommandsResult |
reroute(ClusterState clusterState,
AllocationCommands commands,
boolean explain,
boolean retryFailed) |
ClusterState |
reroute(ClusterState clusterState,
java.lang.String reason)
Reroutes the routing table based on the live nodes.
|
protected ClusterState |
reroute(ClusterState clusterState,
java.lang.String reason,
boolean debug)
Reroutes the routing table based on the live nodes.
|
logDeprecatedSetting, logRemovedSetting, nodeName
@Inject public AllocationService(Settings settings, AllocationDeciders allocationDeciders, GatewayAllocator gatewayAllocator, ShardsAllocator shardsAllocator, ClusterInfoService clusterInfoService)
public ClusterState applyStartedShards(ClusterState clusterState, java.util.List<ShardRouting> startedShards)
If the same instance of the ClusterState
is returned, then no change has been made.
protected ClusterState buildResultAndLogHealthChange(ClusterState oldState, RoutingAllocation allocation, java.lang.String reason)
public ClusterState applyFailedShard(ClusterState clusterState, ShardRouting failedShard)
public ClusterState applyFailedShards(ClusterState clusterState, java.util.List<FailedShard> failedShards)
public ClusterState applyFailedShards(ClusterState clusterState, java.util.List<FailedShard> failedShards, java.util.List<StaleShard> staleShards)
If the same instance of ClusterState is returned, then no change has been made.
public ClusterState deassociateDeadNodes(ClusterState clusterState, boolean reroute, java.lang.String reason)
public AllocationService.CommandsResult reroute(ClusterState clusterState, AllocationCommands commands, boolean explain, boolean retryFailed)
public ClusterState reroute(ClusterState clusterState, java.lang.String reason)
If the same instance of ClusterState is returned, then no change has been made.
protected ClusterState reroute(ClusterState clusterState, java.lang.String reason, boolean debug)
If the same instance of ClusterState is returned, then no change has been made.
protected long currentNanoTime()