Class DiskThresholdDecider

java.lang.Object
org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider

public class DiskThresholdDecider extends AllocationDecider
The DiskThresholdDecider checks that the node a shard is potentially being allocated to has enough disk space. It has three configurable settings, all of which can be changed dynamically: cluster.routing.allocation.disk.watermark.low is the low disk watermark. New shards will not allocated to a node with usage higher than this, although this watermark may be passed by allocating a shard. It defaults to 0.85 (85.0%). cluster.routing.allocation.disk.watermark.high is the high disk watermark. If a node has usage higher than this, shards are not allowed to remain on the node. In addition, if allocating a shard to a node causes the node to pass this watermark, it will not be allowed. It defaults to 0.90 (90.0%). Both watermark settings are expressed in terms of used disk percentage, or exact byte values for free space (like "500mb") cluster.routing.allocation.disk.threshold_enabled is used to enable or disable this decider. It defaults to true (enabled).
  • Field Details

  • Constructor Details

  • Method Details

    • sizeOfRelocatingShards

      public static long sizeOfRelocatingShards(RoutingNode node, boolean subtractShardsMovingAway, String dataPath, ClusterInfo clusterInfo, Metadata metadata, RoutingTable routingTable)
      Returns the size of all shards that are currently being relocated to the node, but may not be finished transferring yet. If subtractShardsMovingAway is true then the size of shards moving away is subtracted from the total size of all shards
    • canAllocate

      public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
      Description copied from class: AllocationDecider
      Returns a Decision whether the given shard routing can be allocated on the given node. The default is Decision.ALWAYS.
      Overrides:
      canAllocate in class AllocationDecider
    • canForceAllocateDuringReplace

      public Decision canForceAllocateDuringReplace(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
      Description copied from class: AllocationDecider
      Returns a Decision whether the given shard can be forced to the given node in the event that the shard's source node is being replaced. This allows nodes using a replace-type node shutdown to override certain deciders in the interest of moving the shard away from a node that *must* be removed. It defaults to returning "YES" and must be overridden by deciders that opt-out to having their other NO decisions *not* overridden while vacating. The caller is responsible for first checking: - that a replacement is ongoing - the shard routing's current node is the source of the replacement
      Overrides:
      canForceAllocateDuringReplace in class AllocationDecider
    • canRemain

      public Decision canRemain(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
      Description copied from class: AllocationDecider
      Returns a Decision whether the given shard routing can be remain on the given node. The default is Decision.ALWAYS.
      Overrides:
      canRemain in class AllocationDecider
    • getExpectedShardSize

      public static long getExpectedShardSize(ShardRouting shard, long defaultValue, ClusterInfo clusterInfo, SnapshotShardSizeInfo snapshotShardSizeInfo, Metadata metadata, RoutingTable routingTable)
      Returns the expected shard size for the given shard or the default value provided if not enough information are available to estimate the shards size.