Package org.elasticsearch.cluster.node

Examples of org.elasticsearch.cluster.node.DiscoveryNode


        outputStream.write(new byte[] { 0x65 });

        UUID transferId = UUID.randomUUID();
        BlobTransferTarget transferTarget = mock(BlobTransferTarget.class);
        TransportService transportService = mock(TransportService.class);
        DiscoveryNode discoveryNode = mock(DiscoveryNode.class);

        PutHeadChunkRunnable runnable = new PutHeadChunkRunnable(
            file, 5, transportService, transferTarget, discoveryNode, transferId
        );
View Full Code Here


            List<ShardRouting> allShards = clusterService().state().routingTable().allShards(index);
            DiscoveryNodes discoveryNodes = clusterService().state().getNodes();
            Set<String> nodes = new HashSet<String>();
            for (ShardRouting shardRouting : allShards) {
                if (shardRouting.assignedToNode()) {
                    DiscoveryNode discoveryNode = discoveryNodes.get(shardRouting.currentNodeId());
                    nodes.add(discoveryNode.getName());
                }
            }
            return nodes;
        }
        return Collections.emptySet();
View Full Code Here

            // send requests
            int i = 0;
            for (List<Object[]> bucket : bucketingIterator) {
                DistributedResultRequest request = this.requests[i];
                request.rows(bucket.toArray(new Object[bucket.size()][]));
                final DiscoveryNode node = downStreams.get(i);
                if (logger.isTraceEnabled()) {
                    logger.trace("[{}] sending distributing collect request to {} ...",
                            jobId.toString(),
                            node.id());
                }
                sendRequest(request, node);
                i++;
            }
        }
View Full Code Here

            NodeService nodeService = mock(NodeService.class);
            NodeStats nodeStats = mock(NodeStats.class);
            when(nodeService.stats()).thenReturn(nodeStats);
            when(nodeStats.getHostname()).thenReturn("localhost");

            DiscoveryNode node = mock(DiscoveryNode.class);
            when(nodeStats.getNode()).thenReturn(node);

            when(nodeStats.getOs()).thenReturn(osStats);
            when(osStats.uptime()).thenReturn(new TimeValue(3600000));
            OsStats.Cpu cpu = mock(OsStats.Cpu.class);
            when(osStats.cpu()).thenReturn(cpu);
            when(cpu.sys()).thenReturn((short) 2);
            when(cpu.user()).thenReturn((short) 4);
            when(cpu.idle()).thenReturn((short) 94);
            when(cpu.stolen()).thenReturn((short) 10);

            ProcessStats processStats = mock(ProcessStats.class);
            when(nodeStats.getProcess()).thenReturn(processStats);
            when(processStats.getOpenFileDescriptors()).thenReturn(42L);

            NodeInfo nodeInfo = mock(NodeInfo.class);
            when(nodeService.info()).thenReturn(nodeInfo);

            ProcessInfo processInfo = mock(ProcessInfo.class);
            when(nodeInfo.getProcess()).thenReturn(processInfo);
            when(processInfo.getMaxFileDescriptors()).thenReturn(1000L);

            Discovery discovery = mock(Discovery.class);
            bind(Discovery.class).toInstance(discovery);
            when(discovery.localNode()).thenReturn(node);
            when(node.getId()).thenReturn("node-id-1");
            when(node.getName()).thenReturn("node 1");
            TransportAddress transportAddress = new InetSocketTransportAddress("localhost", 44300);
            when(node.address()).thenReturn(transportAddress);

            NetworkStats.Tcp tcp = mock(NetworkStats.Tcp.class, new Answer<Long>() {
                @Override
                public Long answer(InvocationOnMock invocation) throws Throwable {
                    return 42L;
View Full Code Here

    private BlobTransferStatus restoreTransferStatus(PutChunkReplicaRequest request, int shardId) {
        logger.trace("Restoring transferContext for PutChunkReplicaRequest with transferId {}",
            request.transferId);

        DiscoveryNode recipientNodeId = clusterService.state().getNodes().get(request.sourceNodeId);
        String senderNodeId = clusterService.localNode().getId();

        BlobTransferInfoResponse transferInfoResponse =
            (BlobTransferInfoResponse)transportService.submitRequest(
                recipientNodeId,
View Full Code Here

            final BlobTransferStatus transferStatus = blobTransferTarget.getActiveTransfer(request.transferId);
            assert transferStatus != null :
                "Received GetBlobHeadRequest for transfer" + request.transferId.toString() + "but don't have an activeTransfer with that id";

            final DiscoveryNode recipientNode = clusterService.state().getNodes().get(request.senderNodeId);
            final File pendingFile = transferStatus.digestBlob().file();
            final long bytesToSend = request.endPos;

            blobTransferTarget.gotAGetBlobHeadRequest(request.transferId);
View Full Code Here

                return null;
            }
            nodeIds.add(shard.currentNodeId());
        }

        DiscoveryNode node;
        DiscoveryNodes nodes = clusterService.state().getNodes();
        for (String nodeId : nodeIds) {
            node = nodes.get(nodeId);
            if (node.getAttributes().containsKey("http_address")) {
                return node.getAttributes().get("http_address") + "/_blobs/" + BlobIndices.indexName(index) + "/" + digest;
            }
            // else:
            // No HttpServer on node,
            // okay if there are replica nodes with httpServer available
        }
View Full Code Here

        // searchPhaseController.getLastEmittedDocPerShard(request, sortedShardList, firstResults.length());

        final AtomicInteger counter = new AtomicInteger(docIdsToLoad.asList().size());
        for (AtomicArray.Entry<IntArrayList> entry : docIdsToLoad.asList()) {
            QuerySearchResult queryResult = firstResults.get(entry.index);
            DiscoveryNode node = nodes.get(queryResult.shardTarget().nodeId());
            FetchSearchRequest fetchSearchRequest = createFetchRequest(queryResult, entry, lastEmittedDocPerShard);
            executeFetch(entry.index, queryResult.shardTarget(), counter, fetchSearchRequest, node);
        }
    }
View Full Code Here

            return;
        }

        for (AtomicArray.Entry<QuerySearchResult> entry : firstResults.asList()) {
            if (docIdsToLoad.get(entry.index) == null) {
                DiscoveryNode node = nodes.get(entry.value.queryResult().shardTarget().nodeId());
                if (node != null) {
                    searchServiceTransportAction.sendFreeContext(node, entry.value.queryResult().id(), EMPTY_SEARCH_REQUEST);
                }
            }
        }
View Full Code Here

    }

    private void raiseEarlyFailure(Throwable t) {
        for (AtomicArray.Entry<QuerySearchResult> entry : firstResults.asList()) {
            try {
                DiscoveryNode node = nodes.get(entry.value.shardTarget().nodeId());
                if (node != null) {
                    searchServiceTransportAction.sendFreeContext(node, entry.value.id(), EMPTY_SEARCH_REQUEST);
                }
            } catch (Throwable t1) {
                logger.trace("failed to release context", t1);
View Full Code Here

TOP

Related Classes of org.elasticsearch.cluster.node.DiscoveryNode

Copyright © 2018 www.massapicom. 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.