public final class UnassignedInfo extends java.lang.Object implements ToXContent, Writeable
Modifier and Type | Class and Description |
---|---|
static class |
UnassignedInfo.AllocationStatus
Captures the status of an unsuccessful allocation attempt for the shard,
causing it to remain in the unassigned state.
|
static class |
UnassignedInfo.Reason
Reason why the shard is in unassigned state.
|
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field and Description |
---|---|
static FormatDateTimeFormatter |
DATE_TIME_FORMATTER |
static Setting<TimeValue> |
INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING |
EMPTY_PARAMS
Constructor and Description |
---|
UnassignedInfo(StreamInput in) |
UnassignedInfo(UnassignedInfo.Reason reason,
java.lang.String message)
creates an UnassignedInfo object based on **current** time
|
UnassignedInfo(UnassignedInfo.Reason reason,
java.lang.String message,
java.lang.Exception failure,
int failedAllocations,
long unassignedTimeNanos,
long unassignedTimeMillis,
boolean delayed,
UnassignedInfo.AllocationStatus lastAllocationStatus) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static long |
findNextDelayedAllocation(long currentNanoTime,
ClusterState state)
Finds the next (closest) delay expiration of an delayed shard in nanoseconds based on current time.
|
java.lang.String |
getDetails()
Builds a string representation of the message and the failure if exists.
|
java.lang.Exception |
getFailure()
Returns additional failure exception details if exists.
|
UnassignedInfo.AllocationStatus |
getLastAllocationStatus()
Get the status for the last allocation attempt for this shard.
|
java.lang.String |
getMessage()
Returns optional details explaining the reasons.
|
static int |
getNumberOfDelayedUnassigned(ClusterState state)
Returns the number of shards that are unassigned and currently being delayed.
|
int |
getNumFailedAllocations()
Returns the number of previously failed allocations of this shard.
|
UnassignedInfo.Reason |
getReason()
The reason why the shard is unassigned.
|
long |
getRemainingDelay(long nanoTimeNow,
Settings indexSettings)
Calculates the delay left based on current time (in nanoseconds) and the delay defined by the index settings.
|
long |
getUnassignedTimeInMillis()
The timestamp in milliseconds when the shard became unassigned, based on System.currentTimeMillis().
|
long |
getUnassignedTimeInNanos()
The timestamp in nanoseconds when the shard became unassigned, based on System.nanoTime().
|
int |
hashCode() |
boolean |
isDelayed()
Returns true if allocation of this shard is delayed due to
INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING |
UnassignedInfo |
readFrom(StreamInput in) |
java.lang.String |
shortSummary() |
java.lang.String |
toString() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
public static final FormatDateTimeFormatter DATE_TIME_FORMATTER
public UnassignedInfo(UnassignedInfo.Reason reason, java.lang.String message)
reason
- the cause for making this shard unassigned. See UnassignedInfo.Reason
for more information.message
- more information about cause.public UnassignedInfo(UnassignedInfo.Reason reason, @Nullable java.lang.String message, @Nullable java.lang.Exception failure, int failedAllocations, long unassignedTimeNanos, long unassignedTimeMillis, boolean delayed, UnassignedInfo.AllocationStatus lastAllocationStatus)
reason
- the cause for making this shard unassigned. See UnassignedInfo.Reason
for more information.message
- more information about cause.failure
- the shard level failure that caused this shard to be unassigned, if exists.unassignedTimeNanos
- the time to use as the base for any delayed re-assignment calculationunassignedTimeMillis
- the time of unassignment used to display to in our reporting.delayed
- if allocation of this shard is delayed due to INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.lastAllocationStatus
- the result of the last allocation attempt for this shardpublic UnassignedInfo(StreamInput in) throws java.io.IOException
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
public UnassignedInfo readFrom(StreamInput in) throws java.io.IOException
java.io.IOException
public int getNumFailedAllocations()
public boolean isDelayed()
INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING
public UnassignedInfo.Reason getReason()
public long getUnassignedTimeInMillis()
public long getUnassignedTimeInNanos()
@Nullable public java.lang.String getMessage()
@Nullable public java.lang.Exception getFailure()
@Nullable public java.lang.String getDetails()
public UnassignedInfo.AllocationStatus getLastAllocationStatus()
public long getRemainingDelay(long nanoTimeNow, Settings indexSettings)
isDelayed()
)
Returns 0 if delay is negativepublic static int getNumberOfDelayedUnassigned(ClusterState state)
public static long findNextDelayedAllocation(long currentNanoTime, ClusterState state)
public java.lang.String shortSummary()
public java.lang.String toString()
toString
in class java.lang.Object
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object