/** * Relocate the shard to another node. * * @param relocatingNodeId id of the node to relocate the shard */ public ShardRouting relocate(String relocatingNodeId, long expectedShardSize) { assert state == ShardRoutingState.STARTED : "current shard has to be started in order to be relocated " + this; return new ShardRouting(shardId, currentNodeId, relocatingNodeId, primary, ShardRoutingState.RELOCATING, recoverySource, null, AllocationId.newRelocation(allocationId), expectedShardSize); }
/** * Relocate the shard to another node. * * @param relocatingNodeId id of the node to relocate the shard */ public ShardRouting relocate(String relocatingNodeId, long expectedShardSize) { assert state == ShardRoutingState.STARTED : "current shard has to be started in order to be relocated " + this; return new ShardRouting(shardId, currentNodeId, relocatingNodeId, primary, ShardRoutingState.RELOCATING, recoverySource, null, AllocationId.newRelocation(allocationId), expectedShardSize); }
/** * Relocate the shard to another node. * * @param relocatingNodeId id of the node to relocate the shard */ public ShardRouting relocate(String relocatingNodeId, long expectedShardSize) { assert state == ShardRoutingState.STARTED : "current shard has to be started in order to be relocated " + this; return new ShardRouting(shardId, currentNodeId, relocatingNodeId, primary, ShardRoutingState.RELOCATING, recoverySource, null, AllocationId.newRelocation(allocationId), expectedShardSize); }
/** * Relocate the shard to another node. * * @param relocatingNodeId id of the node to relocate the shard */ public ShardRouting relocate(String relocatingNodeId, long expectedShardSize) { assert state == ShardRoutingState.STARTED : "current shard has to be started in order to be relocated " + this; return new ShardRouting(shardId, currentNodeId, relocatingNodeId, primary, ShardRoutingState.RELOCATING, recoverySource, null, AllocationId.newRelocation(allocationId), expectedShardSize); }
/** * Relocate the shard to another node. * * @param relocatingNodeId id of the node to relocate the shard */ void relocate(String relocatingNodeId, long expectedShardSize) { ensureNotFrozen(); version++; assert state == ShardRoutingState.STARTED : "current shard has to be started in order to be relocated " + this; state = ShardRoutingState.RELOCATING; this.relocatingNodeId = relocatingNodeId; this.allocationId = AllocationId.newRelocation(allocationId); this.expectedShardSize = expectedShardSize; }
private static AllocationId buildAllocationId(ShardRoutingState state) { switch (state) { case UNASSIGNED: return null; case INITIALIZING: case STARTED: return AllocationId.newInitializing(); case RELOCATING: AllocationId allocationId = AllocationId.newInitializing(); return AllocationId.newRelocation(allocationId); default: throw new IllegalStateException("illegal state"); } }