Module org.elasticsearch.server
Package org.elasticsearch.indices
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptioncheckShardLimit(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.abstract intcountShards(IndexMetadata indexMetadata) protected abstract intnewReplicaShards(boolean isFrozenIndex, int shards, int replicaIncrease) abstract intnewShardsTotal(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.intnewShardsTotal(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.intnewShardsTotal(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.abstract intnumberOfNodes(DiscoveryNodes discoveryNodes) toString()Returns the enum constant of this class with the specified name.static ShardLimitValidator.LimitGroup[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NORMAL
-
FROZEN
-
INDEX
-
SEARCH
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
groupName
-
toString
- Overrides:
toStringin classEnum<ShardLimitValidator.LimitGroup>
-
numberOfNodes
-
countShards
-
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 shardsreplicas- 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
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
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 nodenumberOfNewShards- The number of primary shards that we want to be able to add to the clusterreplicas- The number of replicas of the primary shards that we want to be able to add to the clusterdiscoveryNodes- The nodes in the cluster, used to get the number of open shard already in the clustermetadata- The cluster state metadata, used to get the cluster settings
-