Enum Class ShardLimitValidator.LimitGroup

java.lang.Object
java.lang.Enum<ShardLimitValidator.LimitGroup>
org.elasticsearch.indices.ShardLimitValidator.LimitGroup
All Implemented Interfaces:
Serializable, Comparable<ShardLimitValidator.LimitGroup>, Constable
Enclosing class:
ShardLimitValidator

public static enum ShardLimitValidator.LimitGroup extends Enum<ShardLimitValidator.LimitGroup>
  • Enum Constant Details

  • Method Details

    • values

      public static ShardLimitValidator.LimitGroup[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ShardLimitValidator.LimitGroup valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • groupName

      public String groupName()
    • toString

      public String toString()
      Overrides:
      toString in class Enum<ShardLimitValidator.LimitGroup>
    • numberOfNodes

      public abstract int numberOfNodes(DiscoveryNodes discoveryNodes)
    • countShards

      public abstract int countShards(IndexMetadata indexMetadata)
    • newShardsTotal

      public abstract int newShardsTotal(int shards, int replicas)
      Compute the total number of new shards including both primaries and replicas that would be created for the given number of shards and replicas in this group.
      Parameters:
      shards - Number of primary shards
      replicas - Number of replica shards per primary
      Returns:
      Number of total new shards to be created for the group.
    • newReplicaShards

      protected abstract int newReplicaShards(boolean isFrozenIndex, int shards, int replicaIncrease)
    • newShardsTotal

      public int newShardsTotal(Settings indexSettings)
      Compute the total number of new shards including both primaries and replicas that would be created for an index with the given index settings.
      Parameters:
      indexSettings - The index settings for the index to be created.
      Returns:
      The total number of new shards to be created for this group.
    • newShardsTotal

      public int newShardsTotal(Settings indexSettings, int updatedReplicas)
      Compute the total number of new replica shards that would be created by updating the number of replicas to the given number.
      Parameters:
      indexSettings - The index settings for the index to be updated.
      updatedReplicas - The updated number of replicas for the index.
      Returns:
      The number of new replica shards to be created for this group.
    • checkShardLimit

      public ShardLimitValidator.Result checkShardLimit(int maxConfiguredShardsPerNode, int numberOfNewShards, int replicas, DiscoveryNodes discoveryNodes, Metadata metadata)
      This method checks whether there is enough room in the cluster to add the given number of shards with the given number of replicas without exceeding the max_shards_per_node requirement as specified by maxConfiguredShardsPerNode. This check does not guarantee that the number of shards can be added, just that there is theoretically room to add them without exceeding the shards per node configuration.
      Parameters:
      maxConfiguredShardsPerNode - The maximum available number of shards to be allocated within a node
      numberOfNewShards - The number of primary shards that we want to be able to add to the cluster
      replicas - The number of replicas of the primary shards that we want to be able to add to the cluster
      discoveryNodes - The nodes in the cluster, used to get the number of open shard already in the cluster
      metadata - The cluster state metadata, used to get the cluster settings