|
16 | 16 | import org.elasticsearch.cluster.ClusterState;
|
17 | 17 | import org.elasticsearch.cluster.node.DiscoveryNodes;
|
18 | 18 | import org.elasticsearch.cluster.service.ClusterService;
|
19 |
| -import org.elasticsearch.common.Strings; |
20 | 19 | import org.elasticsearch.common.inject.Inject;
|
21 | 20 | import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
22 | 21 | import org.elasticsearch.common.util.concurrent.AtomicArray;
|
@@ -259,17 +258,18 @@ protected void taskOperation(StopDatafeedAction.Request request, TransportStartD
|
259 | 258 | threadPool.executor(MachineLearning.UTILITY_THREAD_POOL_NAME).execute(new AbstractRunnable() {
|
260 | 259 | @Override
|
261 | 260 | public void onFailure(Exception e) {
|
262 |
| - if ((e instanceof ResourceNotFoundException && |
263 |
| - Strings.isAllOrWildcard(new String[]{request.getDatafeedId()}))) { |
264 |
| - datafeedTask.stop("stop_datafeed (api)", request.getStopTimeout()); |
| 261 | + // We validated that the datafeed names supplied in the request existed when we started processing the action. |
| 262 | + // If the related task for one of them doesn't exist at this point then it must have been removed by a |
| 263 | + // simultaneous force stop request. This is not an error. |
| 264 | + if (ExceptionsHelper.unwrapCause(e) instanceof ResourceNotFoundException) { |
265 | 265 | listener.onResponse(new StopDatafeedAction.Response(true));
|
266 | 266 | } else {
|
267 | 267 | listener.onFailure(e);
|
268 | 268 | }
|
269 | 269 | }
|
270 | 270 |
|
271 | 271 | @Override
|
272 |
| - protected void doRun() throws Exception { |
| 272 | + protected void doRun() { |
273 | 273 | datafeedTask.stop("stop_datafeed (api)", request.getStopTimeout());
|
274 | 274 | listener.onResponse(new StopDatafeedAction.Response(true));
|
275 | 275 | }
|
@@ -343,7 +343,7 @@ protected StopDatafeedAction.Response newResponse(StopDatafeedAction.Request req
|
343 | 343 | throw org.elasticsearch.ExceptionsHelper
|
344 | 344 | .convertToElastic(failedNodeExceptions.get(0));
|
345 | 345 | } else {
|
346 |
| - // This can happen we the actual task in the node no longer exists, |
| 346 | + // This can happen when the actual task in the node no longer exists, |
347 | 347 | // which means the datafeed(s) have already been stopped.
|
348 | 348 | return new StopDatafeedAction.Response(true);
|
349 | 349 | }
|
|
0 commit comments