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
ConstructorDescriptionShrinkShardsCalculator
(StoreStats indexStoreStats, IntFunction<DocsStats> perShardDocStats) -
Method Summary
Modifier and TypeMethodDescriptionint
calculate
(Integer numberOfShards, ByteSizeValue maxPrimaryShardSize, IndexMetadata sourceMetadata) Calculates the target number of shards based on the parameters of the requestprotected static int
calculateAcceptableNumberOfShards
(int sourceIndexShardsNum, int minShardsNum) void
validate
(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:ResizeNumberOfShardsCalculator
Calculates the target number of shards based on the parameters of the request- Specified by:
calculate
in 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:ResizeNumberOfShardsCalculator
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.- Specified by:
validate
in 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)
-