Examples of currentNodeId()


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

                continue;
            }
            if (shard.currentNodeId().equals(clusterService.localNode().getId())) {
                return null;
            }
            nodeIds.add(shard.currentNodeId());
        }

        DiscoveryNode node;
        DiscoveryNodes nodes = clusterService.state().getNodes();
        for (String nodeId : nodeIds) {
View Full Code Here

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

            ShardRouting[] shardRoutings = new ShardRouting[shardIt.size()];
            int currentShard = 0;
            shardIt.reset();
            while ((shard = shardIt.nextOrNull()) != null) {
                shardRoutings[currentShard++] = shard;
                nodeIds.add(shard.currentNodeId());
            }
            groupResponses[currentGroup++] = new ClusterSearchShardsGroup(index, shardId, shardRoutings);
        }
        DiscoveryNode[] nodes = new DiscoveryNode[nodeIds.size()];
        int currentNode = 0;
View Full Code Here

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

        // create count per node id, taking into account relocations
        final ObjectIntOpenHashMap<String> nodeCounts = new ObjectIntOpenHashMap<>();
        for (RoutingNode node : allocation.routingNodes()) {
            for (int i = 0; i < node.size(); i++) {
                ShardRouting shardRouting = node.get(i);
                String nodeId = shardRouting.relocating() ? shardRouting.relocatingNodeId() : shardRouting.currentNodeId();
                nodeCounts.addTo(nodeId, 1);
            }
        }
        RoutingNode[] nodes = allocation.routingNodes().toArray();
        Arrays.sort(nodes, new Comparator<RoutingNode>() {
View Full Code Here

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

                                IndexShardRoutingTable indexShardRoutingTable = indexRoutingTable.shard(shardRouting.id());

                                boolean applyShardEvent = true;

                                for (ShardRouting entry : indexShardRoutingTable) {
                                    if (shardRouting.currentNodeId().equals(entry.currentNodeId())) {
                                        // we found the same shard that exists on the same node id
                                        if (!entry.initializing()) {
                                            // shard is in initialized state, skipping event (probable already started)
                                            logger.debug("{} ignoring shard started event for {}, current state: {}", shardRouting.shardId(), shardRoutingEntry, entry.state());
                                            applyShardEvent = false;
View Full Code Here

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

                    ShardRouting primary = indexRoutingTable.shard(i).primaryShard();
                    if (primary == null || !primary.assignedToNode()) {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(null, State.MISSING, "primary shard is not allocated"));
                    } else if (clusterState.getNodes().smallestVersion().onOrAfter(Version.V_1_2_0) && (primary.relocating() || primary.initializing())) {
                        // The WAITING state was introduced in V1.2.0 - don't use it if there are nodes with older version in the cluster
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.WAITING));
                    } else if (!primary.started()) {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.MISSING, "primary shard hasn't been started yet"));
                    } else {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId()));
                    }
View Full Code Here

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

                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(null, State.MISSING, "primary shard is not allocated"));
                    } else if (clusterState.getNodes().smallestVersion().onOrAfter(Version.V_1_2_0) && (primary.relocating() || primary.initializing())) {
                        // The WAITING state was introduced in V1.2.0 - don't use it if there are nodes with older version in the cluster
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.WAITING));
                    } else if (!primary.started()) {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.MISSING, "primary shard hasn't been started yet"));
                    } else {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId()));
                    }
                } else {
                    builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(null, State.MISSING, "missing routing table"));
View Full Code Here

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

                        // The WAITING state was introduced in V1.2.0 - don't use it if there are nodes with older version in the cluster
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.WAITING));
                    } else if (!primary.started()) {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId(), State.MISSING, "primary shard hasn't been started yet"));
                    } else {
                        builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(primary.currentNodeId()));
                    }
                } else {
                    builder.put(shardId, new SnapshotMetaData.ShardSnapshotStatus(null, State.MISSING, "missing routing table"));
                }
            }
View Full Code Here

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

        ShardIterator shardIterator = clusterService.operationRouting().getShards(clusterState, concreteIndex, request.type(), request.id(), request.routing(), null);
        ShardRouting shardRouting = shardIterator.nextOrNull();
        if (shardRouting == null) {
            throw new ElasticsearchException("No shards for index " + request.index());
        }
        String nodeId = shardRouting.currentNodeId();
        DiscoveryNode discoveryNode = clusterState.nodes().get(nodeId);
        transportService.sendRequest(discoveryNode, MoreLikeThisAction.NAME, request, new TransportResponseHandler<SearchResponse>() {

            @Override
            public SearchResponse newInstance() {
View Full Code Here

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

                    }
                }
                listener.onFailure(failure);
                return;
            }
            if (shardRouting.currentNodeId().equals(nodes.localNodeId())) {
                if (logger.isTraceEnabled()) {
                    logger.trace("executing [{}] on shard [{}]", internalRequest.request(), shardRouting.shardId());
                }
                try {
                    if (internalRequest.request().operationThreaded()) {
View Full Code Here

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

                    }
                } catch (Throwable e) {
                    onFailure(shardRouting, e);
                }
            } else {
                DiscoveryNode node = nodes.get(shardRouting.currentNodeId());
                if (node == null) {
                    onFailure(shardRouting, new NoShardAvailableActionException(shardIt.shardId()));
                } else {
                    transportService.sendRequest(node, transportShardAction, new ShardSingleOperationRequest(internalRequest.request(), shardRouting.shardId()), new BaseTransportResponseHandler<Response>() {
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.