26
26
import org .elasticsearch .cluster .block .ClusterBlocks ;
27
27
import org .elasticsearch .cluster .metadata .MetaData ;
28
28
import org .elasticsearch .cluster .node .DiscoveryNode ;
29
+ import org .elasticsearch .common .Nullable ;
29
30
import org .elasticsearch .common .Randomness ;
30
31
import org .elasticsearch .common .collect .ImmutableOpenMap ;
31
32
import org .elasticsearch .index .Index ;
@@ -420,11 +421,13 @@ public String prettyPrint() {
420
421
421
422
/**
422
423
* Moves a shard from unassigned to initialize state
424
+ *
425
+ * @param existingAllocationId allocation id to use. If null, a fresh allocation id is generated.
423
426
*/
424
- public void initialize (ShardRouting shard , String nodeId , long expectedSize ) {
427
+ public void initialize (ShardRouting shard , String nodeId , @ Nullable String existingAllocationId , long expectedSize ) {
425
428
ensureMutable ();
426
429
assert shard .unassigned () : shard ;
427
- shard .initialize (nodeId , expectedSize );
430
+ shard .initialize (nodeId , existingAllocationId , expectedSize );
428
431
node (nodeId ).add (shard );
429
432
inactiveShardCount ++;
430
433
if (shard .primary ()) {
@@ -692,10 +695,12 @@ public ShardRouting next() {
692
695
693
696
/**
694
697
* Initializes the current unassigned shard and moves it from the unassigned list.
698
+ *
699
+ * @param existingAllocationId allocation id to use. If null, a fresh allocation id is generated.
695
700
*/
696
- public void initialize (String nodeId , long expectedShardSize ) {
701
+ public void initialize (String nodeId , @ Nullable String existingAllocationId , long expectedShardSize ) {
697
702
innerRemove ();
698
- nodes .initialize (new ShardRouting (current ), nodeId , expectedShardSize );
703
+ nodes .initialize (new ShardRouting (current ), nodeId , existingAllocationId , expectedShardSize );
699
704
}
700
705
701
706
/**
@@ -711,7 +716,7 @@ public void removeAndIgnore() {
711
716
712
717
/**
713
718
* Unsupported operation, just there for the interface. Use {@link #removeAndIgnore()} or
714
- * {@link #initialize(String, long)}.
719
+ * {@link #initialize(String, String, long)}.
715
720
*/
716
721
@ Override
717
722
public void remove () {
0 commit comments