Examples of shardId()


Examples of org.elasticsearch.cluster.routing.MutableShardRouting.shardId()

        assertNotNull(fromNodeId);
        assertNotNull(toNodeId);
        assertNotNull(shardToBeMoved);

        logger.info("==> going to move shard [{}] from [{}] to [{}]", shardToBeMoved, fromNodeId, toNodeId);
        return new MoveAllocationCommand(shardToBeMoved.shardId(), fromNodeId, toNodeId);
    }

    @Test
    public void testIndicesAliasesAcknowledgement() {
        createIndex("test");
View Full Code Here

Examples of org.elasticsearch.cluster.routing.MutableShardRouting.shardId()

    public RerouteExplanation execute(RoutingAllocation allocation, boolean explain) throws ElasticsearchException {
        DiscoveryNode discoNode = allocation.nodes().resolveNode(node);
        boolean found = false;
        for (RoutingNodes.RoutingNodeIterator it = allocation.routingNodes().routingNodeIter(discoNode.id()); it.hasNext(); ) {
            MutableShardRouting shardRouting = it.next();
            if (!shardRouting.shardId().equals(shardId)) {
                continue;
            }
            found = true;
            if (shardRouting.relocatingNodeId() != null) {
                if (shardRouting.initializing()) {
View Full Code Here

Examples of org.elasticsearch.cluster.routing.MutableShardRouting.shardId()

                    it.remove();
                    // and cancel the relocating state from the shard its being relocated from
                    RoutingNode relocatingFromNode = allocation.routingNodes().node(shardRouting.relocatingNodeId());
                    if (relocatingFromNode != null) {
                        for (MutableShardRouting fromShardRouting : relocatingFromNode) {
                            if (fromShardRouting.shardId().equals(shardRouting.shardId()) && fromShardRouting.state() == RELOCATING) {
                                allocation.routingNodes().cancelRelocation(fromShardRouting);
                                break;
                            }
                        }
                    }
View Full Code Here

Examples of org.elasticsearch.cluster.routing.MutableShardRouting.shardId()

                    // now, go and find the shard that is initializing on the target node, and cancel it as well...
                    RoutingNodes.RoutingNodeIterator initializingNode = allocation.routingNodes().routingNodeIter(shardRouting.relocatingNodeId());
                    if (initializingNode != null) {
                        while (initializingNode.hasNext()) {
                            MutableShardRouting initializingShardRouting = initializingNode.next();
                            if (initializingShardRouting.shardId().equals(shardRouting.shardId()) && initializingShardRouting.state() == INITIALIZING) {
                                initializingNode.remove();
                            }
                        }
                    }
                }
View Full Code Here

Examples of org.elasticsearch.cluster.routing.MutableShardRouting.shardId()

            it.remove();
            allocation.routingNodes().assign(shardRouting, routingNode.nodeId());
            if (shardRouting.primary()) {
                // we need to clear the post allocation flag, since its an explicit allocation of the primary shard
                // and we want to force allocate it (and create a new index for it)
                allocation.routingNodes().addClearPostAllocationFlag(shardRouting.shardId());
            }
            break;
        }
        return new RerouteExplanation(this, decision);
    }
View Full Code Here

Examples of org.elasticsearch.cluster.routing.ShardIterator.shardId()

                any(ClusterState.class),
                anyString(),
                anyString(),
                Matchers.eq(shardId.toString()),
                anyString())).thenReturn(shardIterator);
        when(shardIterator.shardId()).thenReturn(new ShardId("foo", shardId));
    }
}
View Full Code Here

Examples of org.elasticsearch.cluster.routing.ShardIterator.shardId()

    }

    public ShardId shardId(String digest) {
        ShardIterator si = operationRouting.getShards(clusterService.state(), index.getName(), null, null, digest, "_only_local");
        // TODO: check null and raise
        return si.shardId();
    }

}
View Full Code Here

Examples of org.elasticsearch.cluster.routing.ShardRouting.shardId()

        }
    }

    @Override public void applyFailedShards(NodeAllocations nodeAllocations, FailedRerouteAllocation allocation) {
        ShardRouting failedShard = allocation.failedShard();
        cachedStores.remove(failedShard.shardId());
        cachedShardsState.remove(failedShard.shardId());
    }

    @Override public boolean allocateUnassigned(NodeAllocations nodeAllocations, RoutingAllocation allocation) {
        boolean changed = false;
View Full Code Here

Examples of org.elasticsearch.cluster.routing.ShardRouting.shardId()

    }

    @Override public void applyFailedShards(NodeAllocations nodeAllocations, FailedRerouteAllocation allocation) {
        ShardRouting failedShard = allocation.failedShard();
        cachedStores.remove(failedShard.shardId());
        cachedShardsState.remove(failedShard.shardId());
    }

    @Override public boolean allocateUnassigned(NodeAllocations nodeAllocations, RoutingAllocation allocation) {
        boolean changed = false;
        DiscoveryNodes nodes = allocation.nodes();
View Full Code Here

Examples of org.elasticsearch.cluster.routing.ShardRouting.shardId()

            RoutingNode routingNode = allocation.routingNodes().nodesToShards().get(failedShard.currentNodeId());
            if (routingNode != null) {
                Iterator<MutableShardRouting> shards = routingNode.iterator();
                while (shards.hasNext()) {
                    MutableShardRouting shard = shards.next();
                    if (shard.shardId().equals(failedShard.shardId())) {
                        shardDirty = true;
                        shard.deassignNode();
                        shards.remove();
                        break;
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.