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 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.Params
Nested 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 TypeMethodDescriptionstatic AllocationId
cancelRelocation(AllocationId allocationId)
Creates a new allocation id representing a cancelled relocation.boolean
static AllocationId
finishRelocation(AllocationId allocationId)
Creates a new allocation id finalizing a relocation.static AllocationId
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
getId()
The allocation id uniquely identifying an allocation, note, if it is relocation thegetRelocationId()
need to be taken into account as well.The transient relocation id holding the unique id that is used for relocation.int
hashCode()
static AllocationId
Creates a new allocation id for initializing allocation.static AllocationId
newInitializing(String existingAllocationId)
Creates a new allocation id for initializing allocation based on an existing id.static AllocationId
newRelocation(AllocationId allocationId)
Creates a new allocation id for a shard that moves to be relocated, populating the transient holder for relocationId.static AllocationId
newTargetRelocation(AllocationId allocationId)
Creates a new allocation id for the target initializing shard that is the result of a relocation.toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
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
The allocation id uniquely identifying an allocation, note, if it is relocation thegetRelocationId()
need to be taken into account as well. -
getRelocationId
The transient relocation id holding the unique id that is used for relocation. -
equals
-
hashCode
public int hashCode() -
toString
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
fromXContent
public static AllocationId fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-