forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore cancellation exceptions (elastic#117657) (elastic#118169)
Today, when an ES|QL task encounters an exception, we trigger a cancellation on the root task, causing child tasks to fail due to cancellation. We chose not to include cancellation exceptions in the output, as they are unhelpful and add noise during problem analysis. However, these exceptions are still slipping through via RefCountingListener. This change addresses the issue by introducing ESQLRefCountingListener, ensuring that no cancellation exceptions are returned.
- Loading branch information
Showing
12 changed files
with
135 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 117657 | ||
summary: Ignore cancellation exceptions | ||
area: ES|QL | ||
type: bug | ||
issues: [] |
47 changes: 47 additions & 0 deletions
47
.../plugin/esql/compute/src/main/java/org/elasticsearch/compute/EsqlRefCountingListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.compute; | ||
|
||
import org.elasticsearch.action.ActionListener; | ||
import org.elasticsearch.action.support.RefCountingRunnable; | ||
import org.elasticsearch.compute.operator.FailureCollector; | ||
import org.elasticsearch.core.Releasable; | ||
|
||
/** | ||
* Similar to {@link org.elasticsearch.action.support.RefCountingListener}, | ||
* but prefers non-task-cancelled exceptions over task-cancelled ones as they are more useful for diagnosing issues. | ||
* @see FailureCollector | ||
*/ | ||
public final class EsqlRefCountingListener implements Releasable { | ||
private final FailureCollector failureCollector; | ||
private final RefCountingRunnable refs; | ||
|
||
public EsqlRefCountingListener(ActionListener<Void> delegate) { | ||
this.failureCollector = new FailureCollector(); | ||
this.refs = new RefCountingRunnable(() -> { | ||
Exception error = failureCollector.getFailure(); | ||
if (error != null) { | ||
delegate.onFailure(error); | ||
} else { | ||
delegate.onResponse(null); | ||
} | ||
}); | ||
} | ||
|
||
public ActionListener<Void> acquire() { | ||
return refs.acquireListener().delegateResponse((l, e) -> { | ||
failureCollector.unwrapAndCollect(e); | ||
l.onFailure(e); | ||
}); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
refs.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.