private CompletableFuture<RaftClientReply> staleReadAsync(RaftClientRequest request) { final long minIndex = request.getType().getStaleRead().getMinIndex(); final long commitIndex = state.getLog().getLastCommittedIndex(); LOG.debug("{}: minIndex={}, commitIndex={}", getId(), minIndex, commitIndex); if (commitIndex < minIndex) { final StaleReadException e = new StaleReadException( "Unable to serve stale-read due to server commit index = " + commitIndex + " < min = " + minIndex); return CompletableFuture.completedFuture( new RaftClientReply(request, new StateMachineException(getId(), e), getCommitInfos())); } return processQueryFuture(getStateMachine().queryStale(request.getMessage(), minIndex), request); }
private CompletableFuture<RaftClientReply> staleReadAsync(RaftClientRequest request) { final long minIndex = request.getType().getStaleRead().getMinIndex(); final long commitIndex = state.getLog().getLastCommittedIndex(); LOG.debug("{}: minIndex={}, commitIndex={}", getId(), minIndex, commitIndex); if (commitIndex < minIndex) { final StaleReadException e = new StaleReadException( "Unable to serve stale-read due to server commit index = " + commitIndex + " < min = " + minIndex); return CompletableFuture.completedFuture( new RaftClientReply(request, new StateMachineException(getId(), e), getCommitInfos())); } return processQueryFuture(getStateMachine().queryStale(request.getMessage(), minIndex), request); }
return processQueryFuture(stateMachine.query(request.getMessage()), request);
return processQueryFuture(stateMachine.query(request.getMessage()), request);