/** * 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 if {@link #getAllocationStatus()} returns * {@link AllocationStatus#DELAYED_ALLOCATION}. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public long getRemainingDelayInMillis() { checkDecisionState(); return remainingDelayInMillis; }
/** * 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 if {@link #getAllocationStatus()} returns * {@link AllocationStatus#DELAYED_ALLOCATION}. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public long getConfiguredDelayInMillis() { checkDecisionState(); return configuredDelayInMillis; }
/** * Returns the {@link AllocationDecision} denoting the result of an allocation attempt. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will * throw an {@code IllegalStateException}. */ public AllocationDecision getAllocationDecision() { checkDecisionState(); return AllocationDecision.fromAllocationStatus(allocationStatus); }
/** * Returns the status of an unsuccessful allocation attempt. This value will be {@code null} if * no decision was taken or if the decision was {@link Decision.Type#YES}. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ @Nullable public AllocationStatus getAllocationStatus() { checkDecisionState(); return allocationStatus; }
/** * Gets the allocation id for the existing shard copy that the allocator is assigning the shard to. * This method returns a non-null value iff {@link #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. If {@link #isDecisionTaken()} returns {@code false}, then invoking this method * will throw an {@code IllegalStateException}. */ @Nullable public String getAllocationId() { checkDecisionState(); return allocationId; }
@Override public String getExplanation() { checkDecisionState(); AllocationDecision allocationDecision = getAllocationDecision(); if (allocationDecision == AllocationDecision.YES) {
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { checkDecisionState(); builder.field("can_allocate", getAllocationDecision()); builder.field("allocate_explanation", getExplanation()); if (targetNode != null) { builder.startObject("target_node"); discoveryNodeToXContent(targetNode, true, builder); builder.endObject(); } if (allocationId != null) { builder.field("allocation_id", allocationId); } if (allocationStatus == AllocationStatus.DELAYED_ALLOCATION) { builder.humanReadableField("configured_delay_in_millis", "configured_delay", TimeValue.timeValueMillis(configuredDelayInMillis)); builder.humanReadableField("remaining_delay_in_millis", "remaining_delay", TimeValue.timeValueMillis(remainingDelayInMillis)); } nodeDecisionsToXContent(nodeDecisions, builder, params); return builder; }
/** * 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 if {@link #getAllocationStatus()} returns * {@link AllocationStatus#DELAYED_ALLOCATION}. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public long getConfiguredDelayInMillis() { checkDecisionState(); return configuredDelayInMillis; }
/** * 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 if {@link #getAllocationStatus()} returns * {@link AllocationStatus#DELAYED_ALLOCATION}. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public long getRemainingDelayInMillis() { checkDecisionState(); return remainingDelayInMillis; }
/** * 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 if {@link #getAllocationStatus()} returns * {@link AllocationStatus#DELAYED_ALLOCATION}. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public long getRemainingDelayInMillis() { checkDecisionState(); return remainingDelayInMillis; }
/** * 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 if {@link #getAllocationStatus()} returns * {@link AllocationStatus#DELAYED_ALLOCATION}. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public long getRemainingDelayInMillis() { checkDecisionState(); return remainingDelayInMillis; }
/** * 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 if {@link #getAllocationStatus()} returns * {@link AllocationStatus#DELAYED_ALLOCATION}. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public long getConfiguredDelayInMillis() { checkDecisionState(); return configuredDelayInMillis; }
/** * Gets the allocation id for the existing shard copy that the allocator is assigning the shard to. * This method returns a non-null value iff {@link #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. If {@link #isDecisionTaken()} returns {@code false}, then invoking this method * will throw an {@code IllegalStateException}. */ @Nullable public String getAllocationId() { checkDecisionState(); return allocationId; }
/** * Returns the {@link AllocationDecision} denoting the result of an allocation attempt. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will * throw an {@code IllegalStateException}. */ public AllocationDecision getAllocationDecision() { checkDecisionState(); return AllocationDecision.fromAllocationStatus(allocationStatus); }
/** * Returns the status of an unsuccessful allocation attempt. This value will be {@code null} if * no decision was taken or if the decision was {@link Decision.Type#YES}. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ @Nullable public AllocationStatus getAllocationStatus() { checkDecisionState(); return allocationStatus; }
/** * Gets the allocation id for the existing shard copy that the allocator is assigning the shard to. * This method returns a non-null value iff {@link #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. If {@link #isDecisionTaken()} returns {@code false}, then invoking this method * will throw an {@code IllegalStateException}. */ @Nullable public String getAllocationId() { checkDecisionState(); return allocationId; }
/** * Returns the {@link AllocationDecision} denoting the result of an allocation attempt. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will * throw an {@code IllegalStateException}. */ public AllocationDecision getAllocationDecision() { checkDecisionState(); return AllocationDecision.fromAllocationStatus(allocationStatus); }
/** * Gets the allocation id for the existing shard copy that the allocator is assigning the shard to. * This method returns a non-null value iff {@link #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. If {@link #isDecisionTaken()} returns {@code false}, then invoking this method * will throw an {@code IllegalStateException}. */ @Nullable public String getAllocationId() { checkDecisionState(); return allocationId; }
/** * Returns the {@link AllocationDecision} denoting the result of an allocation attempt. * If {@link #isDecisionTaken()} returns {@code false}, then invoking this method will * throw an {@code IllegalStateException}. */ public AllocationDecision getAllocationDecision() { checkDecisionState(); return AllocationDecision.fromAllocationStatus(allocationStatus); }
/** * Returns the status of an unsuccessful allocation attempt. This value will be {@code null} if * no decision was taken or if the decision was {@link Decision.Type#YES}. If {@link #isDecisionTaken()} * returns {@code false}, then invoking this method will throw an {@code IllegalStateException}. */ @Nullable public AllocationStatus getAllocationStatus() { checkDecisionState(); return allocationStatus; }