Class AllocateUnassignedDecision
java.lang.Object
org.elasticsearch.cluster.routing.allocation.AbstractAllocationDecision
org.elasticsearch.cluster.routing.allocation.AllocateUnassignedDecision
- All Implemented Interfaces:
Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
Represents the allocation decision by an allocator for an unassigned shard.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic AllocateUnassignedDecisiona constant representing a shard decision where no decision was takenFields inherited from class org.elasticsearch.cluster.routing.allocation.AbstractAllocationDecision
nodeDecisions, targetNodeFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AllocateUnassignedDecisiondelayed(long remainingDelay, long totalDelay, List<NodeAllocationResult> decisions)Returns a NO decision for a delayed shard allocation on a replica shard, with the individual node-level decisions that comprised the final NO decision, if in explain mode.booleanstatic AllocateUnassignedDecisionfromDecision(Decision decision, DiscoveryNode assignedNode, List<NodeAllocationResult> nodeDecisions)Creates aAllocateUnassignedDecisionfrom the givenDecisionand the assigned node, if any.Returns theAllocationDecisiondenoting the result of an allocation attempt.Gets the allocation id for the existing shard copy that the allocator is assigning the shard to.Returns the status of an unsuccessful allocation attempt.longGets the total configured delay for allocating the replica shard when a node holding the replica left the cluster and the deciders are waiting to see if the node returns before allocating the replica elsewhere.Gets the explanation for the decision.longGets the remaining delay for allocating the replica shard when a node holding the replica left the cluster and the deciders are waiting to see if the node returns before allocating the replica elsewhere.inthashCode()booleanReturnstrueif a decision was taken by the allocator,falseotherwise.static AllocateUnassignedDecisionno(UnassignedInfo.AllocationStatus allocationStatus, List<NodeAllocationResult> decisions)Returns a NO decision with the givenUnassignedInfo.AllocationStatus, and the individual node-level decisions that comprised the final NO decision if in explain mode.static AllocateUnassignedDecisionno(UnassignedInfo.AllocationStatus allocationStatus, List<NodeAllocationResult> decisions, boolean reuseStore)Returns a NO decision with the givenUnassignedInfo.AllocationStatus, and the individual node-level decisions that comprised the final NO decision if in explain mode.static AllocateUnassignedDecisionthrottle(List<NodeAllocationResult> decisions)Returns a THROTTLE decision, with the individual node-level decisions that comprised the final THROTTLE decision if in explain mode.org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.static AllocateUnassignedDecisionyes(DiscoveryNode assignedNode, String allocationId, List<NodeAllocationResult> decisions, boolean reuseStore)Creates a YES decision with the given individual node-level decisions that comprised the final YES decision, along with the node id to which the shard is assigned and the allocation id for the shard, if available.Methods inherited from class org.elasticsearch.cluster.routing.allocation.AbstractAllocationDecision
atLeastOneNodeWithYesDecision, checkDecisionState, discoveryNodeToXContent, getNodeDecisions, getTargetNode, nodeDecisionsToXContent, sortNodeDecisionsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NOT_TAKEN
a constant representing a shard decision where no decision was taken
-
-
Constructor Details
-
AllocateUnassignedDecision
- Throws:
IOException
-
-
Method Details
-
no
public static AllocateUnassignedDecision no(UnassignedInfo.AllocationStatus allocationStatus, @Nullable List<NodeAllocationResult> decisions)Returns a NO decision with the givenUnassignedInfo.AllocationStatus, and the individual node-level decisions that comprised the final NO decision if in explain mode. -
delayed
public static AllocateUnassignedDecision delayed(long remainingDelay, long totalDelay, @Nullable List<NodeAllocationResult> decisions)Returns a NO decision for a delayed shard allocation on a replica shard, with the individual node-level decisions that comprised the final NO decision, if in explain mode. Instances created with this method will returnUnassignedInfo.AllocationStatus.DELAYED_ALLOCATIONforgetAllocationStatus(). -
no
public static AllocateUnassignedDecision no(UnassignedInfo.AllocationStatus allocationStatus, @Nullable List<NodeAllocationResult> decisions, boolean reuseStore)Returns a NO decision with the givenUnassignedInfo.AllocationStatus, and the individual node-level decisions that comprised the final NO decision if in explain mode. -
throttle
Returns a THROTTLE decision, with the individual node-level decisions that comprised the final THROTTLE decision if in explain mode. -
yes
public static AllocateUnassignedDecision yes(DiscoveryNode assignedNode, @Nullable String allocationId, @Nullable List<NodeAllocationResult> decisions, boolean reuseStore)Creates a YES decision with the given individual node-level decisions that comprised the final YES decision, along with the node id to which the shard is assigned and the allocation id for the shard, if available. -
fromDecision
public static AllocateUnassignedDecision fromDecision(Decision decision, @Nullable DiscoveryNode assignedNode, @Nullable List<NodeAllocationResult> nodeDecisions)Creates aAllocateUnassignedDecisionfrom the givenDecisionand the assigned node, if any. -
isDecisionTaken
public boolean isDecisionTaken()Description copied from class:AbstractAllocationDecisionReturnstrueif a decision was taken by the allocator,falseotherwise. If no decision was taken, then the rest of the fields in this object cannot be accessed and will throw anIllegalStateException.- Specified by:
isDecisionTakenin classAbstractAllocationDecision
-
getAllocationDecision
Returns theAllocationDecisiondenoting the result of an allocation attempt. IfisDecisionTaken()returnsfalse, then invoking this method will throw anIllegalStateException. -
getAllocationStatus
Returns the status of an unsuccessful allocation attempt. This value will benullif no decision was taken or if the decision wasDecision.Type.YES. IfisDecisionTaken()returnsfalse, then invoking this method will throw anIllegalStateException. -
getAllocationId
Gets the allocation id for the existing shard copy that the allocator is assigning the shard to. This method returns a non-null value iffAbstractAllocationDecision.getTargetNode()returns a non-null value and the node on which the shard is assigned already has a shard copy with an in-sync allocation id that we can re-use. IfisDecisionTaken()returnsfalse, then invoking this method will throw anIllegalStateException. -
getRemainingDelayInMillis
public long getRemainingDelayInMillis()Gets the remaining delay for allocating the replica shard when a node holding the replica left the cluster and the deciders are waiting to see if the node returns before allocating the replica elsewhere. Only returns a meaningful positive value ifgetAllocationStatus()returnsUnassignedInfo.AllocationStatus.DELAYED_ALLOCATION. IfisDecisionTaken()returnsfalse, then invoking this method will throw anIllegalStateException. -
getConfiguredDelayInMillis
public long getConfiguredDelayInMillis()Gets the total configured delay for allocating the replica shard when a node holding the replica left the cluster and the deciders are waiting to see if the node returns before allocating the replica elsewhere. Only returns a meaningful positive value ifgetAllocationStatus()returnsUnassignedInfo.AllocationStatus.DELAYED_ALLOCATION. IfisDecisionTaken()returnsfalse, then invoking this method will throw anIllegalStateException. -
getExplanation
Description copied from class:AbstractAllocationDecisionGets the explanation for the decision. IfAbstractAllocationDecision.isDecisionTaken()returnsfalse, then invoking this method will throw anIllegalStateException.- Specified by:
getExplanationin classAbstractAllocationDecision
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classAbstractAllocationDecision- Throws:
IOException
-
equals
- Overrides:
equalsin classAbstractAllocationDecision
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractAllocationDecision
-