/** * Returns {@code true} if the shard cannot remain on its current node and can be moved, * returns {@code false} otherwise. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public boolean forceMove() { checkDecisionState(); return canRemain() == false && allocationDecision == AllocationDecision.YES; }
logger.trace("Moved shard [{}] to node [{}]", shardRouting, targetNode.getRoutingNode()); } else if (moveDecision.isDecisionTaken() && moveDecision.canRemain() == false) { logger.trace("[{}][{}] can't move", shardRouting.index(), shardRouting.id());
@Override public ShardAllocationDecision decideShardAllocation(final ShardRouting shard, final RoutingAllocation allocation) { Balancer balancer = new Balancer(logger, allocation, weightFunction, threshold); AllocateUnassignedDecision allocateUnassignedDecision = AllocateUnassignedDecision.NOT_TAKEN; MoveDecision moveDecision = MoveDecision.NOT_TAKEN; if (shard.unassigned()) { allocateUnassignedDecision = balancer.decideAllocateUnassigned(shard, Sets.newHashSet()); } else { moveDecision = balancer.decideMove(shard); if (moveDecision.isDecisionTaken() && moveDecision.canRemain()) { MoveDecision rebalanceDecision = balancer.decideRebalance(shard); moveDecision = rebalanceDecision.withRemainDecision(moveDecision.getCanRemainDecision()); } } return new ShardAllocationDecision(allocateUnassignedDecision, moveDecision); }
assert canRemain() == false; if (allocationDecision == AllocationDecision.YES) { explanation = "shard cannot remain on this node and is force-moved to another node";
/** * Returns {@code true} if the shard cannot remain on its current node and can be moved, * returns {@code false} otherwise. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public boolean forceMove() { checkDecisionState(); return canRemain() == false && allocationDecision == AllocationDecision.YES; }
/** * Returns {@code true} if the shard cannot remain on its current node and can be moved, * returns {@code false} otherwise. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public boolean forceMove() { checkDecisionState(); return canRemain() == false && allocationDecision == AllocationDecision.YES; }
/** * Returns {@code true} if the shard cannot remain on its current node and can be moved, * returns {@code false} otherwise. If {@link #isDecisionTaken()} returns {@code false}, * then invoking this method will throw an {@code IllegalStateException}. */ public boolean forceMove() { checkDecisionState(); return canRemain() == false && allocationDecision == AllocationDecision.YES; }
@Override public ShardAllocationDecision decideShardAllocation(final ShardRouting shard, final RoutingAllocation allocation) { Balancer balancer = new Balancer(logger, allocation, weightFunction, threshold); AllocateUnassignedDecision allocateUnassignedDecision = AllocateUnassignedDecision.NOT_TAKEN; MoveDecision moveDecision = MoveDecision.NOT_TAKEN; if (shard.unassigned()) { allocateUnassignedDecision = balancer.decideAllocateUnassigned(shard, Sets.newHashSet()); } else { moveDecision = balancer.decideMove(shard); if (moveDecision.isDecisionTaken() && moveDecision.canRemain()) { MoveDecision rebalanceDecision = balancer.decideRebalance(shard); moveDecision = rebalanceDecision.withRemainDecision(moveDecision.getCanRemainDecision()); } } return new ShardAllocationDecision(allocateUnassignedDecision, moveDecision); }
logger.trace("Moved shard [{}] to node [{}]", shardRouting, targetNode.getRoutingNode()); } else if (moveDecision.isDecisionTaken() && moveDecision.canRemain() == false) { logger.trace("[{}][{}] can't move", shardRouting.index(), shardRouting.id());
assert canRemain() == false; if (allocationDecision == AllocationDecision.YES) { explanation = "shard cannot remain on this node and is force-moved to another node";
logger.trace("Moved shard [{}] to node [{}]", shardRouting, targetNode.getRoutingNode()); } else if (moveDecision.isDecisionTaken() && moveDecision.canRemain() == false) { logger.trace("[{}][{}] can't move", shardRouting.index(), shardRouting.id());
logger.trace("Moved shard [{}] to node [{}]", shardRouting, targetNode.getRoutingNode()); } else if (moveDecision.isDecisionTaken() && moveDecision.canRemain() == false) { logger.trace("[{}][{}] can't move", shardRouting.index(), shardRouting.id());
@Override public ShardAllocationDecision decideShardAllocation(final ShardRouting shard, final RoutingAllocation allocation) { Balancer balancer = new Balancer(logger, allocation, weightFunction, threshold); AllocateUnassignedDecision allocateUnassignedDecision = AllocateUnassignedDecision.NOT_TAKEN; MoveDecision moveDecision = MoveDecision.NOT_TAKEN; if (shard.unassigned()) { allocateUnassignedDecision = balancer.decideAllocateUnassigned(shard, Sets.newHashSet()); } else { moveDecision = balancer.decideMove(shard); if (moveDecision.isDecisionTaken() && moveDecision.canRemain()) { MoveDecision rebalanceDecision = balancer.decideRebalance(shard); moveDecision = rebalanceDecision.withRemainDecision(moveDecision.getCanRemainDecision()); } } return new ShardAllocationDecision(allocateUnassignedDecision, moveDecision); }
@Override public ShardAllocationDecision decideShardAllocation(final ShardRouting shard, final RoutingAllocation allocation) { Balancer balancer = new Balancer(logger, allocation, weightFunction, threshold); AllocateUnassignedDecision allocateUnassignedDecision = AllocateUnassignedDecision.NOT_TAKEN; MoveDecision moveDecision = MoveDecision.NOT_TAKEN; if (shard.unassigned()) { allocateUnassignedDecision = balancer.decideAllocateUnassigned(shard, Sets.newHashSet()); } else { moveDecision = balancer.decideMove(shard); if (moveDecision.isDecisionTaken() && moveDecision.canRemain()) { MoveDecision rebalanceDecision = balancer.decideRebalance(shard); moveDecision = rebalanceDecision.withRemainDecision(moveDecision.getCanRemainDecision()); } } return new ShardAllocationDecision(allocateUnassignedDecision, moveDecision); }
assert canRemain() == false; if (allocationDecision == AllocationDecision.YES) { explanation = "shard cannot remain on this node and is force-moved to another node";
assert canRemain() == false; if (allocationDecision == AllocationDecision.YES) { explanation = "shard cannot remain on this node and is force-moved to another node";