Class UndesiredAllocationsTracker

java.lang.Object
org.elasticsearch.cluster.routing.allocation.allocator.UndesiredAllocationsTracker

public class UndesiredAllocationsTracker extends Object
Keeps track of a limited number of shards that are currently in undesired allocations. If the shards remain in undesired allocations for longer than a configurable threshold, it will log why those shards can't be allocated to desired nodes.
  • Field Details

    • UNDESIRED_ALLOCATION_DURATION_LOG_THRESHOLD_SETTING

      public static final Setting<TimeValue> UNDESIRED_ALLOCATION_DURATION_LOG_THRESHOLD_SETTING
      Warning logs will be periodically written if we see a shard that's been in an undesired allocation for this long
    • UNDESIRED_ALLOCATION_DURATION_LOG_INTERVAL_SETTING

      public static final Setting<TimeValue> UNDESIRED_ALLOCATION_DURATION_LOG_INTERVAL_SETTING
      The minimum amount of time between warnings about persistent undesired allocations
    • MAX_UNDESIRED_ALLOCATIONS_TO_TRACK

      public static final Setting<Integer> MAX_UNDESIRED_ALLOCATIONS_TO_TRACK
      The maximum number of undesired allocations to track. We expect this to be relatively small.
  • Method Details

    • trackUndesiredAllocation

      public void trackUndesiredAllocation(ShardRouting shardRouting)
      Track an allocation as being undesired
    • removeTracking

      public void removeTracking(ShardRouting shardRouting)
      Remove any tracking of the specified allocation (a no-op if the allocation isn't being tracked)
    • cleanup

      public void cleanup(RoutingNodes routingNodes)
      Clear any ShardRouting that are no longer present in the routing nodes
    • clear

      public void clear()
      Clear all tracked allocations
    • maybeLogUndesiredShardsWarning

      public void maybeLogUndesiredShardsWarning(RoutingNodes routingNodes, RoutingAllocation routingAllocation, DesiredBalance desiredBalance)
      If there are shards that have been in undesired allocations for longer than the configured threshold, log a warning
    • disableMissingAllocationAssertions

      public Releasable disableMissingAllocationAssertions()