/** * Returns {@code true} if either an allocation decision or a move decision was taken * for the shard. If no decision was taken, as in the case of initializing or relocating * shards, then this method returns {@code false}. */ public boolean isDecisionTaken() { return allocateDecision.isDecisionTaken() || moveDecision.isDecisionTaken(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { if (allocateDecision.isDecisionTaken()) { allocateDecision.toXContent(builder, params); } if (moveDecision.isDecisionTaken()) { moveDecision.toXContent(builder, params); } return builder; }
ShardRouting shardRouting = it.next(); final MoveDecision moveDecision = decideMove(shardRouting); if (moveDecision.isDecisionTaken() && moveDecision.forceMove()) { final ModelNode sourceNode = nodes.get(shardRouting.currentNodeId()); final ModelNode targetNode = nodes.get(moveDecision.getTargetNode().getId()); 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); }
if (shardAllocationDecision.getMoveDecision().isDecisionTaken() && shardAllocationDecision.getMoveDecision().getCurrentNodeRanking() > 0) { builder.field("weight_ranking", shardAllocationDecision.getMoveDecision().getCurrentNodeRanking());
/** * Returns {@code true} if either an allocation decision or a move decision was taken * for the shard. If no decision was taken, as in the case of initializing or relocating * shards, then this method returns {@code false}. */ public boolean isDecisionTaken() { return allocateDecision.isDecisionTaken() || moveDecision.isDecisionTaken(); }
/** * Returns {@code true} if either an allocation decision or a move decision was taken * for the shard. If no decision was taken, as in the case of initializing or relocating * shards, then this method returns {@code false}. */ public boolean isDecisionTaken() { return allocateDecision.isDecisionTaken() || moveDecision.isDecisionTaken(); }
/** * Returns {@code true} if either an allocation decision or a move decision was taken * for the shard. If no decision was taken, as in the case of initializing or relocating * shards, then this method returns {@code false}. */ public boolean isDecisionTaken() { return allocateDecision.isDecisionTaken() || moveDecision.isDecisionTaken(); }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { if (allocateDecision.isDecisionTaken()) { allocateDecision.toXContent(builder, params); } if (moveDecision.isDecisionTaken()) { moveDecision.toXContent(builder, params); } return builder; }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { if (allocateDecision.isDecisionTaken()) { allocateDecision.toXContent(builder, params); } if (moveDecision.isDecisionTaken()) { moveDecision.toXContent(builder, params); } return builder; }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { if (allocateDecision.isDecisionTaken()) { allocateDecision.toXContent(builder, params); } if (moveDecision.isDecisionTaken()) { moveDecision.toXContent(builder, params); } return builder; }
ShardRouting shardRouting = it.next(); final MoveDecision moveDecision = decideMove(shardRouting); if (moveDecision.isDecisionTaken() && moveDecision.forceMove()) { final ModelNode sourceNode = nodes.get(shardRouting.currentNodeId()); final ModelNode targetNode = nodes.get(moveDecision.getTargetNode().getId()); 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());
ShardRouting shardRouting = it.next(); final MoveDecision moveDecision = decideMove(shardRouting); if (moveDecision.isDecisionTaken() && moveDecision.forceMove()) { final ModelNode sourceNode = nodes.get(shardRouting.currentNodeId()); final ModelNode targetNode = nodes.get(moveDecision.getTargetNode().getId()); 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());
ShardRouting shardRouting = it.next(); final MoveDecision moveDecision = decideMove(shardRouting); if (moveDecision.isDecisionTaken() && moveDecision.forceMove()) { final ModelNode sourceNode = nodes.get(shardRouting.currentNodeId()); final ModelNode targetNode = nodes.get(moveDecision.getTargetNode().getId()); 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); }
@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); }
if (shardAllocationDecision.getMoveDecision().isDecisionTaken() && shardAllocationDecision.getMoveDecision().getCurrentNodeRanking() > 0) { builder.field("weight_ranking", shardAllocationDecision.getMoveDecision().getCurrentNodeRanking());
if (shardAllocationDecision.getMoveDecision().isDecisionTaken() && shardAllocationDecision.getMoveDecision().getCurrentNodeRanking() > 0) { builder.field("weight_ranking", shardAllocationDecision.getMoveDecision().getCurrentNodeRanking());
if (shardAllocationDecision.getMoveDecision().isDecisionTaken() && shardAllocationDecision.getMoveDecision().getCurrentNodeRanking() > 0) { builder.field("weight_ranking", shardAllocationDecision.getMoveDecision().getCurrentNodeRanking());