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.
  • 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 provided
      maxPrimaryShardSize - requested max primary shard size or null if it was not provided
      sourceMetadata - the index metadata of the source index
      Returns:
      the number of shards for the target index
    • validate

      void validate(int numberOfShards, IndexMetadata sourceMetadata)
      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 have
      sourceMetadata - the index metadata of the source index