java.lang.Object
org.elasticsearch.indices.ShardLimitValidator
This class contains the logic used to check the cluster-wide shard limit before shards are created and ensuring that the limit is
updated correctly on setting updates, etc.
NOTE: This is the limit applied at *shard creation time*. If you are looking for the limit applied at *allocation* time, which is
controlled by a different setting,
see
ShardsLimitAllocationDecider.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic final recordA Result object containing enough information to be used by external callers about the state of the cluster from the shard limits perspective. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected final AtomicIntegerprotected final AtomicInteger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<ShardLimitValidator.LimitGroup> applicableLimitGroups(boolean isStateless) static intgetShardLimitPerNode(ShardLimitValidator.LimitGroup limitGroup, HealthMetadata.ShardLimits shardLimits) voidvalidateShardLimit(DiscoveryNodes discoveryNodes, Metadata metadata, Index[] indicesToOpen) Validates whether a list of indices can be opened without going over the cluster shard limit.voidvalidateShardLimit(Settings settings, DiscoveryNodes discoveryNodes, Metadata metadata) Checks whether an index can be created without going over the cluster shard limit.voidvalidateShardLimitOnReplicaUpdate(DiscoveryNodes discoveryNodes, Metadata metadata, Index[] indices, int replicas)
-
Field Details
-
SETTING_CLUSTER_MAX_SHARDS_PER_NODE
-
SETTING_CLUSTER_MAX_SHARDS_PER_NODE_FROZEN
-
FROZEN_GROUP
- See Also:
-
NORMAL_GROUP
- See Also:
-
INDEX_SETTING_SHARD_LIMIT_GROUP
-
shardLimitPerNode
-
shardLimitPerNodeFrozen
-
-
Constructor Details
-
ShardLimitValidator
-
-
Method Details
-
getShardLimitPerNode
public static int getShardLimitPerNode(ShardLimitValidator.LimitGroup limitGroup, HealthMetadata.ShardLimits shardLimits) -
validateShardLimit
Checks whether an index can be created without going over the cluster shard limit.- Parameters:
settings- the settings of the index to be createddiscoveryNodes- the nodes in the clustermetadata- the cluster state metadata- Throws:
ValidationException- if creating this index would put the cluster over the cluster shard limit
-
validateShardLimit
public void validateShardLimit(DiscoveryNodes discoveryNodes, Metadata metadata, Index[] indicesToOpen) Validates whether a list of indices can be opened without going over the cluster shard limit. Only counts indices which are currently closed and will be opened, ignores indices which are already open.- Parameters:
discoveryNodes- The nodes in the clustermetadata- The cluster state metadataindicesToOpen- The indices which are to be opened.- Throws:
ValidationException- If this operation would take the cluster over the limit and enforcement is enabled.
-
validateShardLimitOnReplicaUpdate
public void validateShardLimitOnReplicaUpdate(DiscoveryNodes discoveryNodes, Metadata metadata, Index[] indices, int replicas) -
applicableLimitGroups
-