Skip to content

Commit

Permalink
Data frame task failure does not make a 500 response (#44058)
Browse files Browse the repository at this point in the history
Data frame task responses had logic to return a HTTP 500 status code if there was 
any node or task failures even if other tasks in the same request reported correctly. 
This is different to how other task responses are handled where a 200 is always 
returned leaving the client should check for failures. Returning a 500 also breaks
the high level rest client so always return a 200

Closes #44011
  • Loading branch information
davidkyle committed Jul 8, 2019
1 parent 3f3bcb2 commit 5fc1291
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 32 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
import org.elasticsearch.xpack.core.action.util.PageParams;
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
import org.elasticsearch.xpack.core.dataframe.action.GetDataFrameTransformsStatsAction;
Expand All @@ -36,7 +37,7 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient
restRequest.paramAsInt(PageParams.SIZE.getPreferredName(), PageParams.DEFAULT_SIZE)));
}
return channel -> client.execute(GetDataFrameTransformsStatsAction.INSTANCE, request,
new BaseTasksResponseToXContentListener<>(channel));
new RestToXContentListener<>(channel));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
import org.elasticsearch.xpack.core.dataframe.action.StartDataFrameTransformAction;

Expand All @@ -31,7 +32,7 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient
StartDataFrameTransformAction.Request request = new StartDataFrameTransformAction.Request(id, force);
request.timeout(restRequest.paramAsTime(DataFrameField.TIMEOUT.getPreferredName(), AcknowledgedRequest.DEFAULT_ACK_TIMEOUT));
return channel -> client.execute(StartDataFrameTransformAction.INSTANCE, request,
new BaseTasksResponseToXContentListener<>(channel));
new RestToXContentListener<>(channel));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
import org.elasticsearch.xpack.core.dataframe.DataFrameField;
import org.elasticsearch.xpack.core.dataframe.action.StopDataFrameTransformAction;

Expand Down Expand Up @@ -40,7 +41,7 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient
allowNoMatch);

return channel -> client.execute(StopDataFrameTransformAction.INSTANCE, request,
new BaseTasksResponseToXContentListener<>(channel));
new RestToXContentListener<>(channel));
}

@Override
Expand Down

0 comments on commit 5fc1291

Please sign in to comment.