primary
public boolean primary()
Returns
true
iff this shard is a primary.Writeable
, ToXContent
, ToXContentObject
ShardRouting
immutably encapsulates information about shard
indexRoutings like id, state, version, etc.
Information about a particular shard instance.ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
static final long
EMPTY, EMPTY_PARAMS
boolean
active()
boolean
true
iff this shard is assigned to a node ie.boolean
boolean
long
ShardRoutingState.RELOCATING
and ShardRoutingState.INITIALIZING
shards.int
getId()
int
hashCode()
int
id()
index()
initialize(String nodeId,
String existingAllocationId,
long expectedShardSize)
boolean
boolean
boolean
isRelocationSourceOf(ShardRouting other)
boolean
true
if this shard is a relocation target for another shard
(i.e., was created with initializeTargetRelocatingShard()
boolean
isRelocationTargetOf(ShardRouting other)
boolean
isSameAllocation(ShardRouting other)
boolean
moveToStarted(long expectedShardSize)
STARTED
.moveToUnassigned(UnassignedInfo unassignedInfo)
static ShardRouting
newUnassigned(ShardId shardId,
boolean primary,
RecoverySource recoverySource,
UnassignedInfo unassignedInfo,
ShardRouting.Role role)
boolean
primary()
true
iff this shard is a primary.boolean
true
iff the this shard is currently relocating to
another node.role()
shardId()
shardsIt()
boolean
started()
state()
toString()
toXContent(XContentBuilder builder,
ToXContent.Params params)
boolean
updateRelocationFailure(RelocationFailureInfo relocationFailureInfo)
updateUnassigned(UnassignedInfo unassignedInfo,
RecoverySource recoverySource)
void
writeTo(StreamOutput out)
void
writeToThin(StreamOutput out)
StreamOutput
without writing index name and shard idclone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
IOException
IOException
true
iff the this shard is currently relocating to
another node. Otherwise false
true
iff this shard is a primary.StreamOutput
without writing index name and shard idout
- StreamOutput
to write shard information toIOException
- if something happens during writeWriteable
writeTo
in interface Writeable
IOException
existingAllocationId
- allocation id to use. If null, a fresh allocation id is generated.relocatingNodeId
- id of the node to relocate the shardRELOCATING
.INITIALIZING
.
This allows the non-primary shard to continue recovery from the primary even though its non-primary
relocation source has failed.STARTED
. The shards state must be
INITIALIZING
or RELOCATING
. Any relocation will be
canceled.IllegalShardRoutingStateException
- if shard is already a primaryIllegalShardRoutingStateException
- if shard is already a replica
Note: if both shard routing has a null as their allocationId()
, this method returns false as the routing describe
no allocation at all..
true
if this shard is a relocation target for another shard
(i.e., was created with initializeTargetRelocatingShard()
toXContent
in interface ToXContent
IOException
ShardRoutingState.RELOCATING
and ShardRoutingState.INITIALIZING
shards. If it's size is not available -1L will be returned.RecoverySource.PeerRecoverySource
.active()
OperationRouting.canSearchShard(ShardRouting, ClusterState)
to
determine if a shard can be searched and IndexRoutingTable.readyForSearch(ClusterState)
to determine if an index
is ready to be searched.