Class AllocationId
java.lang.Object
org.elasticsearch.cluster.routing.AllocationId
- All Implemented Interfaces:
Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentObject
public class AllocationId extends java.lang.Object implements org.elasticsearch.common.xcontent.ToXContentObject, Writeable
Uniquely identifies an allocation. An allocation is a shard moving from unassigned to initializing,
or relocation.
Relocation is a special case, where the origin shard is relocating with a relocationId and same id, and the target shard (only materialized in RoutingNodes) is initializing with the id set to the origin shard relocationId. Once relocation is done, the new allocation id is set to the relocationId. This is similar behavior to how ShardRouting#currentNodeId is used.
-
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
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Method Summary
Modifier and Type Method Description static AllocationIdcancelRelocation(AllocationId allocationId)Creates a new allocation id representing a cancelled relocation.booleanequals(java.lang.Object o)static AllocationIdfinishRelocation(AllocationId allocationId)Creates a new allocation id finalizing a relocation.static AllocationIdfromXContent(org.elasticsearch.common.xcontent.XContentParser parser)java.lang.StringgetId()The allocation id uniquely identifying an allocation, note, if it is relocation thegetRelocationId()need to be taken into account as well.java.lang.StringgetRelocationId()The transient relocation id holding the unique id that is used for relocation.inthashCode()static AllocationIdnewInitializing()Creates a new allocation id for initializing allocation.static AllocationIdnewInitializing(java.lang.String existingAllocationId)Creates a new allocation id for initializing allocation based on an existing id.static AllocationIdnewRelocation(AllocationId allocationId)Creates a new allocation id for a shard that moves to be relocated, populating the transient holder for relocationId.static AllocationIdnewTargetRelocation(AllocationId allocationId)Creates a new allocation id for the target initializing shard that is the result of a relocation.java.lang.StringtoString()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.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput. -
newInitializing
Creates a new allocation id for initializing allocation. -
newInitializing
Creates a new allocation id for initializing allocation based on an existing id. -
newTargetRelocation
Creates a new allocation id for the target initializing shard that is the result of a relocation. -
newRelocation
Creates a new allocation id for a shard that moves to be relocated, populating the transient holder for relocationId. -
cancelRelocation
Creates a new allocation id representing a cancelled relocation.Note that this is expected to be called on the allocation id of the *source* shard
-
finishRelocation
Creates a new allocation id finalizing a relocation.Note that this is expected to be called on the allocation id of the *target* shard and thus it only needs to clear the relocating id.
-
getId
public java.lang.String getId()The allocation id uniquely identifying an allocation, note, if it is relocation thegetRelocationId()need to be taken into account as well. -
getRelocationId
public java.lang.String getRelocationId()The transient relocation id holding the unique id that is used for relocation. -
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
fromXContent
public static AllocationId fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException- Throws:
java.io.IOException
-