Module org.elasticsearch.server
Class ResizeNumberOfShardsCalculator.ShrinkShardsCalculator
java.lang.Object
org.elasticsearch.action.admin.indices.shrink.ResizeNumberOfShardsCalculator.ShrinkShardsCalculator
- All Implemented Interfaces:
ResizeNumberOfShardsCalculator
- Enclosing interface:
ResizeNumberOfShardsCalculator
public static class ResizeNumberOfShardsCalculator.ShrinkShardsCalculator
extends Object
implements ResizeNumberOfShardsCalculator
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.action.admin.indices.shrink.ResizeNumberOfShardsCalculator
ResizeNumberOfShardsCalculator.CloneShardsCalculator, ResizeNumberOfShardsCalculator.ShrinkShardsCalculator, ResizeNumberOfShardsCalculator.SplitShardsCalculator -
Constructor Summary
ConstructorsConstructorDescriptionShrinkShardsCalculator(StoreStats indexStoreStats, IntFunction<DocsStats> perShardDocStats) -
Method Summary
Modifier and TypeMethodDescriptionintcalculate(Integer numberOfShards, ByteSizeValue maxPrimaryShardSize, IndexMetadata sourceMetadata) Calculates the target number of shards based on the parameters of the requestprotected static intcalculateAcceptableNumberOfShards(int sourceIndexShardsNum, int minShardsNum) voidvalidate(int numberOfShards, IndexMetadata sourceMetadata) Validates the target number of shards based on the operation.
-
Constructor Details
-
ShrinkShardsCalculator
-
-
Method Details
-
calculate
public int calculate(Integer numberOfShards, ByteSizeValue maxPrimaryShardSize, IndexMetadata sourceMetadata) Description copied from interface:ResizeNumberOfShardsCalculatorCalculates the target number of shards based on the parameters of the request- Specified by:
calculatein interfaceResizeNumberOfShardsCalculator- 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
Description copied from interface:ResizeNumberOfShardsCalculatorValidates 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.- Specified by:
validatein interfaceResizeNumberOfShardsCalculator- Parameters:
numberOfShards- the number of shards the target index is going to havesourceMetadata- the index metadata of the source index
-
calculateAcceptableNumberOfShards
protected static int calculateAcceptableNumberOfShards(int sourceIndexShardsNum, int minShardsNum)
-