Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class EsqlExecutionInfo implements ChunkedToXContentObject, Writeable {
private final transient Long relativeStartNanos; // start time for an ESQL query for calculating took times
private transient TimeValue planningTookTime; // time elapsed since start of query to calling ComputeService.execute
private volatile boolean isPartial; // Does this request have partial results?
private transient volatile boolean isStopped; // Have we received stop command?

public EsqlExecutionInfo(boolean includeCCSMetadata) {
this(Predicates.always(), includeCCSMetadata); // default all clusters to skip_unavailable=true
Expand Down Expand Up @@ -311,6 +312,14 @@ public void markAsPartial() {
isPartial = true;
}

public void markAsStopped() {
isStopped = true;
}

public boolean isStopped() {
return isStopped;
}

/**
* Mark this cluster as having partial results.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void execute(
exchangeSource,
cancelQueryOnFailure,
localListener.acquireCompute().map(r -> {
localClusterWasInterrupted.set(execInfo.isPartial());
localClusterWasInterrupted.set(execInfo.isStopped());
if (execInfo.isCrossClusterSearch() && execInfo.clusterAliases().contains(LOCAL_CLUSTER)) {
execInfo.swapCluster(
LOCAL_CLUSTER,
Expand Down Expand Up @@ -292,7 +292,7 @@ public void execute(
private void updateExecutionInfo(EsqlExecutionInfo executionInfo, String clusterAlias, ComputeResponse resp) {
Function<EsqlExecutionInfo.Cluster.Status, EsqlExecutionInfo.Cluster.Status> runningToSuccess = status -> {
if (status == EsqlExecutionInfo.Cluster.Status.RUNNING) {
return executionInfo.isPartial() ? EsqlExecutionInfo.Cluster.Status.PARTIAL : EsqlExecutionInfo.Cluster.Status.SUCCESSFUL;
return executionInfo.isStopped() ? EsqlExecutionInfo.Cluster.Status.PARTIAL : EsqlExecutionInfo.Cluster.Status.SUCCESSFUL;
} else {
return status;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void stopQueryAndReturnResult(Task task, AsyncExecutionId asyncId, Actio
logger.debug("Async stop for task {} - stopping", asyncIdStr);
final EsqlExecutionInfo esqlExecutionInfo = asyncTask.executionInfo();
if (esqlExecutionInfo != null) {
esqlExecutionInfo.markAsPartial();
esqlExecutionInfo.markAsStopped();
}
Runnable getResults = () -> getResultsAction.execute(task, getAsyncResultRequest, listener);
exchangeService.finishSessionEarly(sessionID(asyncId), ActionListener.running(() -> {
Expand Down