Class AbstractAllocateAllocationCommand

org.elasticsearch.cluster.routing.allocation.command.AbstractAllocateAllocationCommand
All Implemented Interfaces:
AllocationCommand, NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject
Direct Known Subclasses:
AllocateReplicaAllocationCommand, BasePrimaryAllocationCommand

public abstract class AbstractAllocateAllocationCommand extends implements AllocationCommand
Abstract base class for allocating an unassigned shard to a node
  • Field Details

    • index

      protected final  index
    • shardId

      protected final int shardId
    • node

      protected final  node
  • Constructor Details

    • AbstractAllocateAllocationCommand

      protected AbstractAllocateAllocationCommand( index, int shardId,  node)
    • AbstractAllocateAllocationCommand

      protected AbstractAllocateAllocationCommand(StreamInput in) throws
      Read from a stream.
      Throws:
  • Method Details

    • createAllocateParser

      protected static <T extends AbstractAllocateAllocationCommand.Builder<?>> org.elasticsearch.common.xcontent.ObjectParser<T,​> createAllocateParser( command)
    • writeTo

      public void writeTo(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
    • index

      public  index()
      Get the index name
      Returns:
      name of the index
    • shardId

      public int shardId()
      Get the shard id
      Returns:
      id of the shard
    • node

      public  node()
      Get the id of the node
      Returns:
      id of the node
    • explainOrThrowMissingRoutingNode

      protected RerouteExplanation explainOrThrowMissingRoutingNode(RoutingAllocation allocation, boolean explain, DiscoveryNode discoNode)
      Handle case where a disco node cannot be found in the routing table. Usually means that it's not a data node.
    • explainOrThrowRejectedCommand

      protected RerouteExplanation explainOrThrowRejectedCommand(boolean explain, RoutingAllocation allocation,  reason)
      Utility method for rejecting the current allocation command based on provided reason
    • explainOrThrowRejectedCommand

      protected RerouteExplanation explainOrThrowRejectedCommand(boolean explain, RoutingAllocation allocation,  rte)
      Utility method for rejecting the current allocation command based on provided exception
    • initializeUnassignedShard

      protected void initializeUnassignedShard(RoutingAllocation allocation, RoutingNodes routingNodes, RoutingNode routingNode, ShardRouting shardRouting)
      Initializes an unassigned shard on a node and removes it from the unassigned
      Parameters:
      allocation - the allocation
      routingNodes - the routing nodes
      routingNode - the node to initialize it to
      shardRouting - the shard routing that is to be matched in unassigned shards
    • initializeUnassignedShard

      protected void initializeUnassignedShard(RoutingAllocation allocation, RoutingNodes routingNodes, RoutingNode routingNode, ShardRouting shardRouting, @Nullable UnassignedInfo unassignedInfo, @Nullable RecoverySource recoverySource)
      Initializes an unassigned shard on a node and removes it from the unassigned
      Parameters:
      allocation - the allocation
      routingNodes - the routing nodes
      routingNode - the node to initialize it to
      shardRouting - the shard routing that is to be matched in unassigned shards
      unassignedInfo - unassigned info to override
      recoverySource - recovery source to override
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
    • extraXContent

      protected void extraXContent(org.elasticsearch.common.xcontent.XContentBuilder builder) throws
      Throws:
    • equals

      public boolean equals( obj)
      Overrides:
       in class 
    • hashCode

      public int hashCode()
      Overrides:
       in class