Class IndexReshardingState.Split

java.lang.Object
org.elasticsearch.cluster.metadata.IndexReshardingState
org.elasticsearch.cluster.metadata.IndexReshardingState.Split
All Implemented Interfaces:
Writeable, ToXContent, ToXContentFragment
Enclosing class:
IndexReshardingState

public static final class IndexReshardingState.Split extends IndexReshardingState
  • Method Details

    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Throws:
      IOException
    • toXContent

      public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
      Throws:
      IOException
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • shardCountBefore

      public int shardCountBefore()
      Specified by:
      shardCountBefore in class IndexReshardingState
      Returns:
      the number of shards the index has at the start of this operation
    • shardCountAfter

      public int shardCountAfter()
      Specified by:
      shardCountAfter in class IndexReshardingState
      Returns:
      the number of shards that the index will have when resharding completes
    • sourceShard

      public int sourceShard(int targetShard)
    • newSplitByMultiple

      public static IndexReshardingState.Split newSplitByMultiple(int shardCount, int multiple)
      Create resharding metadata representing a new split operation Split only supports updating an index to a multiple of its current shard count
      Parameters:
      shardCount - the number of shards in the index at the start of the operation
      multiple - the new shard count is shardCount * multiple
      Returns:
      Split representing the start of the requested split
    • builder

      Create a Builder from the state of this Split The Split itself is immutable. Modifications can be applied to the builder, which can be used to replace the current Split in IndexMetadata when it in turn is built.
      Returns:
      a Builder reflecting the state of this split
    • getSourceShardState

      public IndexReshardingState.Split.SourceShardState getSourceShardState(int shardNum)
      Get the current shard state of a source shard
      Parameters:
      shardNum - an index into the shards which must be no greater than the number of shards before split
      Returns:
      the source shard state of the shard identified by shardNum
    • isSourceShard

      public boolean isSourceShard(int shardId)
    • isTargetShard

      public boolean isTargetShard(int shardId)
    • getTargetShardState

      public IndexReshardingState.Split.TargetShardState getTargetShardState(int shardNum)
      Get the current target state of a shard
      Parameters:
      shardNum - an index into shards greater than or equal to the old shard count and less than the new shard count
      Returns:
      the target shard state for the shard identified by shardNum
    • targetStateAtLeast

      public boolean targetStateAtLeast(int shardNum, IndexReshardingState.Split.TargetShardState targetShardState)
    • inProgress

      public boolean inProgress()
      Check whether this metadata represents an incomplete split
      Returns:
      true if the split is incomplete (not all source shards are DONE)
    • targetStates

    • sourceStates

    • targetsDone

      public boolean targetsDone(int shardNum)
      Check whether all target shards for the given source shard are done.
      Parameters:
      shardNum - a source shard index greater than or equal to 0 and less than the original shard count
      Returns:
      true if all target shards for the given source shard are done.