Class AbstractAllocateAllocationCommand

    • Field Detail

      • index

        protected final java.lang.String index
      • shardId

        protected final int shardId
      • node

        protected final java.lang.String node
    • Constructor Detail

      • AbstractAllocateAllocationCommand

        protected AbstractAllocateAllocationCommand​(java.lang.String index,
                                                    int shardId,
                                                    java.lang.String node)
      • AbstractAllocateAllocationCommand

        protected AbstractAllocateAllocationCommand​(StreamInput in)
                                             throws java.io.IOException
        Read from a stream.
        Throws:
        java.io.IOException
    • Method Detail

      • index

        public java.lang.String 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 java.lang.String 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,
                                                                   java.lang.String reason)
        Utility method for rejecting the current allocation command based on provided reason
      • explainOrThrowRejectedCommand

        protected RerouteExplanation explainOrThrowRejectedCommand​(boolean explain,
                                                                   RoutingAllocation allocation,
                                                                   java.lang.RuntimeException 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
      • extraXContent

        protected void extraXContent​(XContentBuilder builder)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object