Skip to content

Commit 4c9c824

Browse files
Improve ShardRoutingState docs (#126875)
1 parent 75f8e4a commit 4c9c824

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

server/src/main/java/org/elasticsearch/cluster/routing/ShardRoutingState.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,38 @@
1010
package org.elasticsearch.cluster.routing;
1111

1212
/**
13-
* Represents the current state of a {@link ShardRouting} as defined by the
14-
* cluster.
13+
* Tracks the current assignment status of a particular shard copy ({@link ShardRouting}).
1514
*/
1615
public enum ShardRoutingState {
1716
/**
18-
* The shard is not assigned to any node.
17+
* The shard is not assigned to any node; any data which it contains is unavailable to the cluster.
18+
* <p>
19+
* A shard transitions from {@link #UNASSIGNED} to {@link #INITIALIZING} when the master wants an assigned data node to create or start
20+
* recovering that shard copy. A shard may also transition back to {@link #UNASSIGNED} in case of any failure, during initialization or
21+
* later.
1922
*/
2023
UNASSIGNED((byte) 1),
24+
2125
/**
22-
* The shard is initializing (probably recovering from either a peer shard
23-
* or gateway).
26+
* The shard is assigned to a node and the recovery process has begun. The shard data is not yet available on the node initializing the
27+
* shard (though there is a small window of time when the data is available, after recovery completes and before the cluster state is
28+
* updated to mark the shard {@link #STARTED}).
29+
* <p>
30+
* A shard transitions from {@link #INITIALIZING} -> {@link #STARTED} when recovery is complete and the data node informs the master
31+
* that it is ready to serve requests.
2432
*/
2533
INITIALIZING((byte) 2),
34+
2635
/**
27-
* The shard is started.
36+
* The shard is assigned to a specific data node and ready to accept indexing and search requests.
37+
* <p>
38+
* A shard transitions from {@link #STARTED} -> {@link #RELOCATING} when the master wants to initialize the shard elsewhere.
2839
*/
2940
STARTED((byte) 3),
41+
3042
/**
31-
* The shard is in the process being relocated.
43+
* The shard is being reassigned away from one node to another node. This is the state of the shard on a source node when the shard is
44+
* being moved away to a new target node. The target shard copy will be {@link #INITIALIZING}.
3245
*/
3346
RELOCATING((byte) 4);
3447

0 commit comments

Comments
 (0)