org.elasticsearch.transport.TransportRequestOptions Java Examples

The following examples show how to use org.elasticsearch.transport.TransportRequestOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemoteRecoveryTargetHandler.java    From crate with Apache License 2.0 6 votes vote down vote up
public RemoteRecoveryTargetHandler(long recoveryId, ShardId shardId, TransportService transportService,
                                   DiscoveryNode targetNode, RecoverySettings recoverySettings, Consumer<Long> onSourceThrottle) {
    this.transportService = transportService;
    this.recoveryId = recoveryId;
    this.shardId = shardId;
    this.targetNode = targetNode;
    this.recoverySettings = recoverySettings;
    this.onSourceThrottle = onSourceThrottle;
    this.translogOpsRequestOptions = TransportRequestOptions.builder()
            .withCompress(true)
            .withType(TransportRequestOptions.Type.RECOVERY)
            .withTimeout(recoverySettings.internalActionLongTimeout())
            .build();
    this.fileChunkRequestOptions = TransportRequestOptions.builder()
            .withCompress(false)  // lucene files are already compressed and therefore compressing this won't really help much so
            // we are saving the cpu for other things
            .withType(TransportRequestOptions.Type.RECOVERY)
            .withTimeout(recoverySettings.internalActionTimeout())
            .build();

}
 
Example #2
Source File: DLBasedIndexRecoverySourceHandler.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
protected void prepareTargetForTranslog() {
    StopWatch stopWatch = new StopWatch().start();
    logger.trace("{} recovery [phase1] to {}: prepare remote engine for translog", request.shardId(), request.targetNode());
    final long startEngineStart = stopWatch.totalTime().millis();
    cancellableThreads.execute(new Interruptable() {
        @Override
        public void run() throws InterruptedException {
            // Send a request preparing the new shard's translog to receive
            // operations. This ensures the shard engine is started and disables
            // garbage collection (not the JVM's GC!) of tombstone deletes
            transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.PREPARE_TRANSLOG,
                    new RecoveryPrepareForTranslogOperationsRequest(request.recoveryId(), request.shardId(), 0),
                    TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(), EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
        }
    });

    stopWatch.stop();

    response.startTime = stopWatch.totalTime().millis() - startEngineStart;
    logger.trace("{} recovery [phase1] to {}: remote engine start took [{}]",
            request.shardId(), request.targetNode(), stopWatch.totalTime());
}
 
Example #3
Source File: MockTransport.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public Connection openConnection(DiscoveryNode node, ConnectionProfile profile) {
    return new CloseableConnection() {
        @Override
        public DiscoveryNode getNode() {
            return node;
        }

        @Override
        public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
            throws TransportException {
            requests.put(requestId, Tuple.tuple(node, action));
            onSendRequest(requestId, action, request, node);
        }

        @Override
        public String toString() {
            return "MockTransportConnection{node=" + node + ", requests=" + requests + '}';
        }
    };
}
 
Example #4
Source File: DisruptableMockTransport.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public Connection openConnection(DiscoveryNode node, ConnectionProfile profile) {
    final Optional<DisruptableMockTransport> matchingTransport = getDisruptableMockTransport(node.getAddress());
    if (matchingTransport.isPresent()) {
        return new CloseableConnection() {
            @Override
            public DiscoveryNode getNode() {
                return node;
            }

            @Override
            public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
                throws TransportException {
                onSendRequest(requestId, action, request, matchingTransport.get());
            }

            @Override
            public String toString() {
                return "DisruptableMockTransportConnection{node=" + node + '}';
            }
        };
    } else {
        throw new ConnectTransportException(node, "node " + node + " does not exist");
    }
}
 
Example #5
Source File: BlobRecoverySourceHandler.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
protected void prepareTargetForTranslog(final Translog.View translogView) {
    StopWatch stopWatch = new StopWatch().start();
    logger.trace("{} recovery [phase1] to {}: prepare remote engine for translog", request.shardId(), request.targetNode());
    final long startEngineStart = stopWatch.totalTime().millis();
    cancellableThreads.execute(new Interruptable() {
        @Override
        public void run() throws InterruptedException {
            // Send a request preparing the new shard's translog to receive
            // operations. This ensures the shard engine is started and disables
            // garbage collection (not the JVM's GC!) of tombstone deletes
            transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.PREPARE_TRANSLOG,
                    new RecoveryPrepareForTranslogOperationsRequest(request.recoveryId(), request.shardId(), translogView.totalOperations()),
                    TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(), EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
        }
    });

    stopWatch.stop();

    response.startTime = stopWatch.totalTime().millis() - startEngineStart;
    logger.trace("{} recovery [phase1] to {}: remote engine start took [{}]",
            request.shardId(), request.targetNode(), stopWatch.totalTime());
}
 
Example #6
Source File: RecoverySourceHandler.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
protected void prepareTargetForTranslog(final Translog.View translogView) {
    StopWatch stopWatch = new StopWatch().start();
    logger.trace("{} recovery [phase1] to {}: prepare remote engine for translog", request.shardId(), request.targetNode());
    final long startEngineStart = stopWatch.totalTime().millis();
    cancellableThreads.execute(new Interruptable() {
        @Override
        public void run() throws InterruptedException {
            // Send a request preparing the new shard's translog to receive
            // operations. This ensures the shard engine is started and disables
            // garbage collection (not the JVM's GC!) of tombstone deletes
            transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.PREPARE_TRANSLOG,
                    new RecoveryPrepareForTranslogOperationsRequest(request.recoveryId(), request.shardId(), translogView.totalOperations()),
                    TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(), EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
        }
    });

    stopWatch.stop();

    response.startTime = stopWatch.totalTime().millis() - startEngineStart;
    logger.trace("{} recovery [phase1] to {}: remote engine start took [{}]",
            request.shardId(), request.targetNode(), stopWatch.totalTime());
}
 
Example #7
Source File: JoinHelper.java    From crate with Apache License 2.0 6 votes vote down vote up
void sendValidateJoinRequest(DiscoveryNode node, ClusterState state, ActionListener<TransportResponse.Empty> listener) {
    transportService.sendRequest(node, VALIDATE_JOIN_ACTION_NAME,
        new ValidateJoinRequest(state),
        TransportRequestOptions.builder().withTimeout(joinTimeout).build(),
        new EmptyTransportResponseHandler(ThreadPool.Names.GENERIC) {
            @Override
            public void handleResponse(TransportResponse.Empty response) {
                listener.onResponse(response);
            }

            @Override
            public void handleException(TransportException exp) {
                listener.onFailure(exp);
            }
        });
}
 
Example #8
Source File: BlobRecoveryHandler.java    From crate with Apache License 2.0 6 votes vote down vote up
private Set<BytesArray> getExistingDigestsFromTarget(byte prefix) {
    BlobStartPrefixResponse response =
        (BlobStartPrefixResponse) transportService.submitRequest(
            request.targetNode(),
            BlobRecoveryTarget.Actions.START_PREFIX,
            new BlobStartPrefixSyncRequest(request.recoveryId(), request.shardId(), prefix),
            TransportRequestOptions.EMPTY,
            new FutureTransportResponseHandler<TransportResponse>() {

                @Override
                public TransportResponse read(StreamInput in) throws IOException {
                    return new BlobStartPrefixResponse(in);
                }
            }
        ).txGet();

    Set<BytesArray> result = new HashSet<>();
    for (byte[] digests : response.existingDigests) {
        result.add(new BytesArray(digests));
    }
    return result;
}
 
Example #9
Source File: TransportNodeStatsAction.java    From crate with Apache License 2.0 6 votes vote down vote up
public void execute(final String nodeName,
                    final NodeStatsRequest request,
                    final ActionListener<NodeStatsResponse> listener,
                    final TimeValue timeout) {
    TransportRequestOptions options = TransportRequestOptions.builder()
        .withTimeout(timeout)
        .build();

    transports.sendRequest(
        ACTION_NAME,
        nodeName,
        request,
        listener,
        new ActionListenerResponseHandler<>(listener, NodeStatsResponse::new),
        options
    );
}
 
Example #10
Source File: Transports.java    From crate with Apache License 2.0 6 votes vote down vote up
public <TRequest extends TransportRequest, TResponse extends TransportResponse> void sendRequest(
    String action,
    String node,
    TRequest request,
    ActionListener<TResponse> listener,
    TransportResponseHandler<TResponse> handler,
    TransportRequestOptions options) {

    DiscoveryNode discoveryNode = clusterService.state().nodes().get(node);
    if (discoveryNode == null) {
        listener.onFailure(new NodeNotConnectedException(null,
            String.format(Locale.ENGLISH, "node \"%s\" not found in cluster state!", node)));
        return;
    }
    transportService.sendRequest(discoveryNode, action, request, options, handler);
}
 
Example #11
Source File: BlobRecoveryHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
private void deleteFilesRequest(BytesArray[] digests) {
    transportService.submitRequest(
        request.targetNode(),
        BlobRecoveryTarget.Actions.DELETE_FILE,
        new BlobRecoveryDeleteRequest(request.recoveryId(), digests),
        TransportRequestOptions.EMPTY,
        EmptyTransportResponseHandler.INSTANCE_SAME
    ).txGet();
}
 
Example #12
Source File: AnomalyResultTransportAction.java    From anomaly-detection with Apache License 2.0 5 votes vote down vote up
@Inject
public AnomalyResultTransportAction(
    ActionFilters actionFilters,
    TransportService transportService,
    Settings settings,
    ADStateManager manager,
    ColdStartRunner eventExecutor,
    FeatureManager featureManager,
    ModelManager modelManager,
    HashRing hashRing,
    ClusterService clusterService,
    IndexNameExpressionResolver indexNameExpressionResolver,
    ADCircuitBreakerService adCircuitBreakerService,
    ADStats adStats
) {
    super(AnomalyResultAction.NAME, transportService, actionFilters, AnomalyResultRequest::new);
    this.transportService = transportService;
    this.stateManager = manager;
    this.globalRunner = eventExecutor;
    this.featureManager = featureManager;
    this.modelManager = modelManager;
    this.hashRing = hashRing;
    this.option = TransportRequestOptions
        .builder()
        .withType(TransportRequestOptions.Type.REG)
        .withTimeout(AnomalyDetectorSettings.REQUEST_TIMEOUT.get(settings))
        .build();
    this.clusterService = clusterService;
    this.indexNameExpressionResolver = indexNameExpressionResolver;
    this.adCircuitBreakerService = adCircuitBreakerService;
    this.adStats = adStats;
}
 
Example #13
Source File: RemoteRecoveryTargetHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void ensureClusterStateVersion(long clusterStateVersion) {
    transportService.submitRequest(targetNode, PeerRecoveryTargetService.Actions.WAIT_CLUSTERSTATE,
        new RecoveryWaitForClusterStateRequest(recoveryId, shardId, clusterStateVersion),
        TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionLongTimeout()).build(),
            EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
}
 
Example #14
Source File: RemoteRecoveryTargetHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void handoffPrimaryContext(final ReplicationTracker.PrimaryContext primaryContext) {
    transportService.submitRequest(
            targetNode,
            PeerRecoveryTargetService.Actions.HANDOFF_PRIMARY_CONTEXT,
            new RecoveryHandoffPrimaryContextRequest(recoveryId, shardId, primaryContext),
            TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(),
            EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
}
 
Example #15
Source File: RemoteRecoveryTargetHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void receiveFileInfo(List<String> phase1FileNames, List<Long> phase1FileSizes, List<String> phase1ExistingFileNames,
                            List<Long> phase1ExistingFileSizes, int totalTranslogOps) {

    RecoveryFilesInfoRequest recoveryInfoFilesRequest = new RecoveryFilesInfoRequest(recoveryId, shardId,
            phase1FileNames, phase1FileSizes, phase1ExistingFileNames, phase1ExistingFileSizes, totalTranslogOps);
    transportService.submitRequest(targetNode, PeerRecoveryTargetService.Actions.FILES_INFO, recoveryInfoFilesRequest,
            TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(),
            EmptyTransportResponseHandler.INSTANCE_SAME).txGet();

}
 
Example #16
Source File: RemoteRecoveryTargetHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void cleanFiles(int totalTranslogOps, Store.MetadataSnapshot sourceMetaData) throws IOException {
    transportService.submitRequest(targetNode, PeerRecoveryTargetService.Actions.CLEAN_FILES,
            new RecoveryCleanFilesRequest(recoveryId, shardId, sourceMetaData, totalTranslogOps),
            TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(),
            EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
}
 
Example #17
Source File: Transports.java    From crate with Apache License 2.0 5 votes vote down vote up
public <TRequest extends TransportRequest, TResponse extends TransportResponse> void sendRequest(
    String action,
    String node,
    TRequest request,
    ActionListener<TResponse> listener,
    TransportResponseHandler<TResponse> handler) {
    sendRequest(action, node, request, listener, handler, TransportRequestOptions.EMPTY);
}
 
Example #18
Source File: RemoteRecoveryTargetHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void finalizeRecovery(final long globalCheckpoint, final ActionListener<Void> listener) {
    transportService.submitRequest(
        targetNode,
        PeerRecoveryTargetService.Actions.FINALIZE,
        new RecoveryFinalizeRecoveryRequest(recoveryId, shardId, globalCheckpoint),
        TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionLongTimeout()).build(),
        new ActionListenerResponseHandler<>(
            ActionListener.wrap(r -> listener.onResponse(null), listener::onFailure),
            in -> TransportResponse.Empty.INSTANCE, ThreadPool.Names.GENERIC
        )
    );
}
 
Example #19
Source File: BlobRecoveryHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
private void sendFinalizeRecoveryRequest() {
    transportService.submitRequest(request.targetNode(),
        BlobRecoveryTarget.Actions.FINALIZE_RECOVERY,
        new BlobFinalizeRecoveryRequest(request.recoveryId()),
        TransportRequestOptions.EMPTY,
        EmptyTransportResponseHandler.INSTANCE_SAME
    ).txGet();
}
 
Example #20
Source File: BlobRecoveryHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
private void sendStartRecoveryRequest() {
    transportService.submitRequest(request.targetNode(),
        BlobRecoveryTarget.Actions.START_RECOVERY,
        new BlobStartRecoveryRequest(request.recoveryId(), request.shardId()),
        TransportRequestOptions.EMPTY,
        EmptyTransportResponseHandler.INSTANCE_SAME
    ).txGet();
}
 
Example #21
Source File: StubbableTransport.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options)
    throws IOException, TransportException {
    TransportAddress address = connection.getNode().getAddress();
    SendRequestBehavior behavior = sendBehaviors.getOrDefault(address, defaultSendRequest);
    if (behavior == null) {
        connection.sendRequest(requestId, action, request, options);
    } else {
        behavior.sendRequest(connection, requestId, action, request, options);
    }
}
 
Example #22
Source File: MockTransportService.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a rule that will cause ignores each send request, simulating an unresponsive node
 * and failing to connect once the rule was added.
 */
public void addUnresponsiveRule(TransportAddress transportAddress) {
    transport().addConnectBehavior(transportAddress, (transport, discoveryNode, profile) -> {
        throw new ConnectTransportException(discoveryNode, "UNRESPONSIVE: simulated");
    });

    transport().addSendBehavior(
        transportAddress,
        new StubbableTransport.SendRequestBehavior() {
            private Set<Transport.Connection> toClose = ConcurrentHashMap.newKeySet();

            @Override
            public void sendRequest(Transport.Connection connection,
                                    long requestId,
                                    String action,
                                    TransportRequest request,
                                    TransportRequestOptions options) {
                // don't send anything, the receiving node is unresponsive
                toClose.add(connection);
            }

            @Override
            public void clearCallback() {
                // close to simulate that tcp-ip eventually times out and closes connection
                // (necessary to ensure transport eventually responds).
                try {
                    IOUtils.close(toClose);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    );
}
 
Example #23
Source File: MockTransportService.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
protected void traceRequestSent(DiscoveryNode node, long requestId, String action, TransportRequestOptions options) {
    super.traceRequestSent(node, requestId, action, options);
    for (Tracer tracer : activeTracers) {
        tracer.requestSent(node, requestId, action, options);
    }
}
 
Example #24
Source File: BlobHeadRequestHandlerTests.java    From crate with Apache License 2.0 5 votes vote down vote up
@Test
public void testPutHeadChunkRunnableFileDoesntGrow() throws Exception {
    // this test is rather slow, tune wait time in PutHeadChunkRunnable?
    expectedException.expect(HeadChunkFileTooSmallException.class);

    File file = File.createTempFile("test", "");
    File notExisting = new File("./does/not/exist");
    try (final FileOutputStream outputStream = new FileOutputStream(file)) {
        outputStream.write(new byte[]{0x65});
    }
    UUID transferId = UUID.randomUUID();
    BlobTransferTarget transferTarget = mock(BlobTransferTarget.class);
    TransportService transportService = mock(TransportService.class);
    DiscoveryNode discoveryNode = mock(DiscoveryNode.class);

    DigestBlob digestBlob = mock(DigestBlob.class);
    when(digestBlob.file()).thenReturn(notExisting);
    when(digestBlob.getContainerFile()).thenReturn(file);
    PutHeadChunkRunnable runnable = new PutHeadChunkRunnable(
        digestBlob, 5, transportService, transferTarget, discoveryNode, transferId
    );

    @SuppressWarnings("unchecked")
    TransportFuture<TransportResponse.Empty> result = mock(TransportFuture.class);
    when(transportService.submitRequest(
        eq(discoveryNode),
        eq(BlobHeadRequestHandler.Actions.PUT_BLOB_HEAD_CHUNK),
        any(TransportRequest.class),
        any(TransportRequestOptions.class),
        eq(EmptyTransportResponseHandler.INSTANCE_SAME)
    )).thenReturn(result);

    runnable.run();
    verify(digestBlob).getContainerFile();
}
 
Example #25
Source File: RemoteRecoveryTargetHandler.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void prepareForTranslogOperations(boolean fileBasedRecovery,
                                         int totalTranslogOps,
                                         ActionListener<Void> listener) {
    transportService.submitRequest(
        targetNode,
        PeerRecoveryTargetService.Actions.PREPARE_TRANSLOG,
        new RecoveryPrepareForTranslogOperationsRequest(recoveryId, shardId, totalTranslogOps, fileBasedRecovery),
        TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionTimeout()).build(),
        new ActionListenerResponseHandler<>(
            ActionListener.wrap(r -> listener.onResponse(null), listener::onFailure),
            in -> TransportResponse.Empty.INSTANCE, ThreadPool.Names.GENERIC)
    );
}
 
Example #26
Source File: IngestAction.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@Override
public TransportRequestOptions transportOptions(Settings settings) {
    return TransportRequestOptions.builder()
            .withType(TransportRequestOptions.Type.BULK)
            .withTimeout(settings.getAsTime("action.ingest.timeout", TimeValue.timeValueSeconds(60)))
            .withCompress(settings.getAsBoolean("action.ingest.compress", true))
            .build();
}
 
Example #27
Source File: DLBasedIndexRecoverySourceHandler.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private void recoverFromTranslog() {
    final RecoveryTranslogOperationsRequest translogOperationsRequest = new RecoveryTranslogOperationsRequest(
            request.recoveryId(), request.shardId(), new ArrayList<Translog.Operation>(), 0);
    final TransportRequestOptions recoveryOptions = TransportRequestOptions.builder()
            .withCompress(recoverySettings.compress())
            .withType(TransportRequestOptions.Type.RECOVERY)
            .withTimeout(recoverySettings.internalActionLongTimeout())
            .build();
    transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.TRANSLOG_OPS, translogOperationsRequest,
            recoveryOptions, EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
}
 
Example #28
Source File: DLBasedIndexRecoverySourceHandler.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void finalizeRecovery() {
    if (shard.state() == IndexShardState.CLOSED) {
        throw new IndexShardClosedException(request.shardId());
    }
    cancellableThreads.checkForCancel();
    StopWatch stopWatch = new StopWatch().start();
    logger.trace("[{}][{}] finalizing recovery to {}", indexName, shardId, request.targetNode());


    cancellableThreads.execute(new Interruptable() {
        @Override
        public void run() throws InterruptedException {
            // Send the FINALIZE request to the target node. The finalize request
            // clears unreferenced translog files, refreshes the engine now that
            // new segments are available, and enables garbage collection of
            // tombstone files. The shard is also moved to the POST_RECOVERY phase
            // during this time
            transportService.submitRequest(request.targetNode(), RecoveryTarget.Actions.FINALIZE,
                    new RecoveryFinalizeRecoveryRequest(request.recoveryId(), request.shardId()),
                    TransportRequestOptions.builder().withTimeout(recoverySettings.internalActionLongTimeout()).build(),
                    EmptyTransportResponseHandler.INSTANCE_SAME).txGet();
        }
    });


    if (request.markAsRelocated()) {
        // TODO what happens if the recovery process fails afterwards, we need to mark this back to started
        try {
            shard.relocated("to " + request.targetNode());
        } catch (IllegalIndexShardStateException e) {
            // we can ignore this exception since, on the other node, when it moved to phase3
            // it will also send shard started, which might cause the index shard we work against
            // to move be closed by the time we get to the the relocated method
        }
    }
    stopWatch.stop();
    logger.trace("[{}][{}] finalizing recovery to {}: took [{}]",
            indexName, shardId, request.targetNode(), stopWatch.totalTime());
}
 
Example #29
Source File: BulkAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public TransportRequestOptions transportOptions(Settings settings) {
    return TransportRequestOptions.builder()
            .withType(TransportRequestOptions.Type.BULK)
            .withCompress(settings.getAsBoolean("action.bulk.compress", true)
            ).build();
}
 
Example #30
Source File: PullFullClusterStateAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public void pullFullClusterStateFromNode(final DiscoveryNode node, final TimeValue publishTimeout) {
    if (isPullingState) {
        return;
    }
    isPullingState = true;
    TransportRequestOptions options = TransportRequestOptions.builder().withType(TransportRequestOptions.Type.STATE).withCompress(false).withTimeout(publishTimeout).build();
    transportService.sendRequest(node, PULL_FULL_STATE_ACTION_NAME, 
            new PullFullClusterStateRequest(clusterService.state().getClusterName(), localNode), options,
            new PullFullClusterStateFromNodeResponseHandler());
}