Module org.elasticsearch.server
Interface ResizeNumberOfShardsCalculator
- All Known Implementing Classes:
ResizeNumberOfShardsCalculator.CloneShardsCalculator,ResizeNumberOfShardsCalculator.ShrinkShardsCalculator,ResizeNumberOfShardsCalculator.SplitShardsCalculator
public interface ResizeNumberOfShardsCalculator
This class calculates and verifies the number of shards of a target index after a resize operation. It supports three operations SHRINK,
SPLIT and CLONE.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionintcalculate(Integer numberOfShards, ByteSizeValue maxPrimaryShardSize, IndexMetadata sourceMetadata) Calculates the target number of shards based on the parameters of the requestvoidvalidate(int numberOfShards, IndexMetadata sourceMetadata) Validates the target number of shards based on the operation.
-
Method Details
-
calculate
int calculate(@Nullable Integer numberOfShards, @Nullable ByteSizeValue maxPrimaryShardSize, IndexMetadata sourceMetadata) Calculates the target number of shards based on the parameters of the request- Parameters:
numberOfShards- requested number of shards or null if it was not providedmaxPrimaryShardSize- requested max primary shard size or null if it was not providedsourceMetadata- the index metadata of the source index- Returns:
- the number of shards for the target index
-
validate
Validates the target number of shards based on the operation. For example, in the case of SHRINK it will check if the doc count per shard is within limits and in the other opetations it will ensure we get the right exceptions if the number of shards is wrong or less than etc.- Parameters:
numberOfShards- the number of shards the target index is going to havesourceMetadata- the index metadata of the source index
-