Examples of shardId()


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

        }

        Iterator<MutableShardRouting> shards = currentRoutingNode.iterator();
        while (shards.hasNext()) {
            MutableShardRouting shard = shards.next();
            if (shard.shardId().equals(failedShard.shardId())) {
                shardDirty = true;
                if (!inRelocation) {
                    shard.deassignNode();
                    shards.remove();
                } else {
View Full Code Here

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

        if (!shardDirty) {
            return false;
        }

        // make sure we ignore this shard on the relevant node
        allocation.addIgnoreShardForNode(failedShard.shardId(), failedShard.currentNodeId());

        // if in relocation no need to find a new target, just cancel the relocation.
        if (inRelocation) {
            return true; // lets true, so we reroute in this case
        }
View Full Code Here

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

        assertThat(routingNodes.node("node1").numberOfShardsWithState(STARTED), lessThan(3));
        assertThat(routingNodes.node("node2").numberOfShardsWithState(STARTED, RELOCATING), equalTo(2));
        assertThat(routingNodes.node("node2").numberOfShardsWithState(STARTED), lessThan(3));
        assertThat(routingNodes.node("node3").numberOfShardsWithState(INITIALIZING), equalTo(1));
        // make sure the failedShard is not INITIALIZING again on node3
        assertThat(routingNodes.node("node3").shards().get(0).shardId(), not(equalTo(shardToFail.shardId())));
    }
}
View Full Code Here

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

                // we only deal with primary shardIt here...
                if (!shard.primary()) {
                    continue;
                }
                if (!shard.active() || !nodes.nodeExists(shard.currentNodeId())) {
                    retry(fromClusterEvent, shard.shardId());
                    return false;
                }

                // check here for consistency
                if (checkWriteConsistency) {
View Full Code Here

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

                    } else if (consistencyLevel == WriteConsistencyLevel.ALL) {
                        requiredNumber = shardIt.size();
                    }

                    if (shardIt.sizeActive() < requiredNumber) {
                        retry(fromClusterEvent, shard.shardId());
                        return false;
                    }
                }

                if (!primaryOperationStarted.compareAndSet(false, true)) {
View Full Code Here

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

                            if (exp.unwrapCause() instanceof ConnectTransportException || exp.unwrapCause() instanceof NodeClosedException ||
                                    exp.unwrapCause() instanceof IllegalIndexShardStateException) {
                                primaryOperationStarted.set(false);
                                // we already marked it as started when we executed it (removed the listener) so pass false
                                // to re-add to the cluster listener
                                retry(false, shard.shardId());
                            } else {
                                listener.onFailure(exp);
                            }
                        }
                    });
View Full Code Here

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

                    // which is fine, we should just ignore this
                    if (indexMetaData == null) {
                        continue;
                    }
                    if (!indexMetaData.isSameUUID(shardRoutingEntry.indexUUID)) {
                        logger.debug("{} ignoring shard failed, different index uuid, current {}, got {}", shardRouting.shardId(), indexMetaData.getUUID(), shardRoutingEntry);
                        continue;
                    }

                    logger.debug("{} will apply shard failed {}", shardRouting.shardId(), shardRoutingEntry);
                    shardRoutingsToBeApplied.add(shardRouting);
View Full Code Here

Examples of org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand.shardId()

        for (Client client : clients()) {
            ClusterState clusterState = getLocalClusterState(client);
            for (MutableShardRouting mutableShardRouting : clusterState.routingNodes().routingNodeIter(moveAllocationCommand.fromNode())) {
                //if the shard that we wanted to move is still on the same node, it must be relocating
                if (mutableShardRouting.shardId().equals(moveAllocationCommand.shardId())) {
                    assertThat(mutableShardRouting.relocating(), equalTo(true));
                }

            }
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard.shardId()

                if (entry.primary() && entry.started()) {
                    // only recover from started primary, if we can't find one, we will do it next round
                    final DiscoveryNode sourceNode = nodes.get(entry.currentNodeId());
                    try {
                        // we are recovering a backup from a primary, so no need to mark it as relocated
                        final StartRecoveryRequest request = new StartRecoveryRequest(indexShard.shardId(), sourceNode, nodes.localNode(), false, indexShard.store().list());
                        recoveryTarget.startRecovery(request, false, new PeerRecoveryListener(request, shardRouting, indexService));
                    } catch (Exception e) {
                        handleRecoveryFailure(indexService, shardRouting, true, e);
                        break;
                    }
View Full Code Here

Examples of org.elasticsearch.index.shard.service.IndexShard.shardId()

                // relocating primaries, recovery from the relocating shard
                final DiscoveryNode sourceNode = nodes.get(shardRouting.relocatingNodeId());
                try {
                    // we don't mark this one as relocated at the end, requests in any case are routed to both when its relocating
                    // and that way we handle the edge case where its mark as relocated, and we might need to roll it back...
                    final StartRecoveryRequest request = new StartRecoveryRequest(indexShard.shardId(), sourceNode, nodes.localNode(), false, indexShard.store().list());
                    recoveryTarget.startRecovery(request, false, new PeerRecoveryListener(request, shardRouting, indexService));
                } catch (Exception e) {
                    handleRecoveryFailure(indexService, shardRouting, true, e);
                }
            }
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.