Class ClusterInfoSimulator

java.lang.Object
org.elasticsearch.cluster.ClusterInfoSimulator

public class ClusterInfoSimulator extends Object
  • Constructor Details

  • Method Details

    • simulateShardStarted

      public void simulateShardStarted(ShardRouting shard)
    • simulateShardStarted

      public void simulateShardStarted(ShardRouting shard, boolean includeIndexUsage)
      This method updates disk usage to reflect shard relocations and new replica initialization. In case of a single data path both mostAvailableSpaceUsage and leastAvailableSpaceUsage are update to reflect the change. In case of multiple data path only mostAvailableSpaceUsage as it is used in calculation in DiskThresholdDecider for allocating new shards. This assumes the worst case (all shards are placed on a single most used disk) and prevents node overflow. Balance is later recalculated with a refreshed cluster info containing actual shards placement. A relocating shard will have the current node ID set for the new node, and the relocating ID set for the previous node. A new shard will have the current ID set for the new node, and relocating ID will be null.
    • simulateAddIndexToNode

      public void simulateAddIndexToNode(String nodeId, Index index)
    • simulateRemoveIndexFromNode

      public void simulateRemoveIndexFromNode(String nodeId, Index index)
    • getEstimatedHeapUsages

      public Map<String,EstimatedHeapUsage> getEstimatedHeapUsages()
    • simulateAlreadyStartedShard

      public void simulateAlreadyStartedShard(ShardRouting startedShard, @Nullable String sourceNodeId)
      This method simulates starting an already started shard with an optional sourceNodeId in case of a relocation.
      Parameters:
      startedShard - The shard to simulate. Must be started already.
      sourceNodeId - The source node ID if the shard started as a result of relocation. null otherwise.
    • getClusterInfo

      public ClusterInfo getClusterInfo()