private boolean validateRequest(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime()); int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver); return readyCounter == waitFor; }
executeHealth(request, listener);
final ClusterStateObserver observer = new ClusterStateObserver(state, clusterService, null, logger, threadPool.getThreadContext()); if (request.timeout().millis() == 0) { listener.onResponse(getResponse(request, state, waitFor, request.timeout().millis() == 0)); return; final Predicate<ClusterState> validationPredicate = newState -> validateRequest(request, newState, concreteWaitFor);
private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor, boolean timedOut) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime()); int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver); boolean valid = (readyCounter == waitFor); assert valid || timedOut; // we check for a timeout here since this method might be called from the wait_for_events // response handler which might have timed out already. // if the state is sufficient for what we where waiting for we don't need to mark this as timedOut. // We spend too much time in waiting for events such that we might already reached a valid state. // this should not mark the request as timed out response.setTimedOut(timedOut && valid == false); return response; }
final ClusterStateObserver observer = new ClusterStateObserver(state, clusterService, null, logger, threadPool.getThreadContext()); if (request.timeout().millis() == 0) { listener.onResponse(getResponse(request, state, waitFor, request.timeout().millis() == 0)); return; final Predicate<ClusterState> validationPredicate = newState -> validateRequest(request, newState, concreteWaitFor);
executeHealth(request, listener);
private boolean validateRequest(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.numberOfPendingTasks(), 0, clusterService.getMaxTaskWaitTime()); return prepareResponse(request, response, clusterState, waitFor); }
final ClusterStateObserver observer = new ClusterStateObserver(state, clusterService, null, logger, threadPool.getThreadContext()); if (request.timeout().millis() == 0) { listener.onResponse(getResponse(request, state, waitFor, request.timeout().millis() == 0)); return; final Predicate<ClusterState> validationPredicate = newState -> validateRequest(request, newState, concreteWaitFor);
executeHealth(request, listener);
private boolean validateRequest(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMaxTaskWaitTime()); return prepareResponse(request, response, clusterState, waitFor); }
final ClusterStateObserver observer = new ClusterStateObserver(state, clusterService, null, logger, threadPool.getThreadContext()); if (request.timeout().millis() == 0) { listener.onResponse(getResponse(request, state, waitFor, request.timeout().millis() == 0)); return; final Predicate<ClusterState> validationPredicate = newState -> validateRequest(request, newState, concreteWaitFor);
executeHealth(request, listener);
private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor, boolean timedOut) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.numberOfPendingTasks(), 0, clusterService.getMaxTaskWaitTime()); boolean valid = prepareResponse(request, response, clusterState, waitFor); assert valid || timedOut; // we check for a timeout here since this method might be called from the wait_for_events // response handler which might have timed out already. // if the state is sufficient for what we where waiting for we don't need to mark this as timedOut. // We spend too much time in waiting for events such that we might already reached a valid state. // this should not mark the request as timed out response.setTimedOut(timedOut && valid == false); return response; }
final ClusterState state = observer.observedState(); if (waitFor == 0 || request.timeout().millis() == 0) { listener.onResponse(getResponse(request, state, waitFor, request.timeout().millis() == 0)); return; if (state.status() == ClusterState.ClusterStateStatus.APPLIED && validateRequest(request, state, concreteWaitFor)) { stateListener.onNewClusterState(state); } else {
executeHealth(request, listener);
private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor, boolean timedOut) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMaxTaskWaitTime()); boolean valid = prepareResponse(request, response, clusterState, waitFor); assert valid || timedOut; // we check for a timeout here since this method might be called from the wait_for_events // response handler which might have timed out already. // if the state is sufficient for what we where waiting for we don't need to mark this as timedOut. // We spend too much time in waiting for events such that we might already reached a valid state. // this should not mark the request as timed out response.setTimedOut(timedOut && valid == false); return response; }
private boolean validateRequest(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime()); int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver); return readyCounter == waitFor; }
private boolean validateRequest(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime()); int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver); return readyCounter == waitFor; }
private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor, boolean timedOut) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime()); int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver); boolean valid = (readyCounter == waitFor); assert valid || timedOut; // we check for a timeout here since this method might be called from the wait_for_events // response handler which might have timed out already. // if the state is sufficient for what we where waiting for we don't need to mark this as timedOut. // We spend too much time in waiting for events such that we might already reached a valid state. // this should not mark the request as timed out response.setTimedOut(timedOut && valid == false); return response; }
private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor, boolean timedOut) { ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(), gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime()); int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver); boolean valid = (readyCounter == waitFor); assert valid || timedOut; // we check for a timeout here since this method might be called from the wait_for_events // response handler which might have timed out already. // if the state is sufficient for what we where waiting for we don't need to mark this as timedOut. // We spend too much time in waiting for events such that we might already reached a valid state. // this should not mark the request as timed out response.setTimedOut(timedOut && valid == false); return response; }