Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate xpack and typed endpoints for graph explore api #74230

Merged
merged 4 commits into from
Jun 29, 2021

Conversation

pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Jun 17, 2021

Previously the /{index}/{type}/_xpack/graph/_explore api was indicating to use /{index}/{type}/_graph/explore which is also deprecated.
This commit deprecates all typed endpoints

@@ -253,7 +253,7 @@ private void dispatchRequest(RestRequest request, RestChannel channel, RestHandl
if (handler.allowsUnsafeBuffers() == false) {
request.ensureSafeBuffers();
}

//TODO why we are using client.threadPool().getThreadContext() ?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should not be using the thread context passed over via AbstractHttpServerTransport#dispatchRequest
The thread pool is first created in node and is the used in both RestController and AbstracthttpServerTransport

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOF! Good catch. This is a mistake IMO; we should do one of the following things:

  1. Remove ThreadContext from the request dispatcher API and always use the one from the node client
  2. Leave the API alone and pass the ThreadContext from the dispatcher to all the other methods
  3. Add an assertion in dispatch*Request methods that assert the passed threadcontext is the same as that on the node client

This mainly is just an issue for testing but it is tricky and would be nice if we just had one way to access the value

@@ -66,7 +66,10 @@ protected RestController controller() {
protected void dispatchRequest(RestRequest request) {
FakeRestChannel channel = new FakeRestChannel(request, false, 1);
ThreadContext threadContext = new ThreadContext(Settings.EMPTY);
controller.dispatchRequest(request, channel, threadContext);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this in fact was not really chaning the context used in RestController - not in all places.
In same places the thread context fetched from thread pool was used

@pgomulka pgomulka requested review from jaymode and joegallo June 17, 2021 11:26
@pgomulka pgomulka self-assigned this Jun 17, 2021
@pgomulka pgomulka added the :Core/Infra/REST API REST infrastructure and utilities label Jun 17, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jun 17, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@@ -253,7 +253,7 @@ private void dispatchRequest(RestRequest request, RestChannel channel, RestHandl
if (handler.allowsUnsafeBuffers() == false) {
request.ensureSafeBuffers();
}

//TODO why we are using client.threadPool().getThreadContext() ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOF! Good catch. This is a mistake IMO; we should do one of the following things:

  1. Remove ThreadContext from the request dispatcher API and always use the one from the node client
  2. Leave the API alone and pass the ThreadContext from the dispatcher to all the other methods
  3. Add an assertion in dispatch*Request methods that assert the passed threadcontext is the same as that on the node client

This mainly is just an issue for testing but it is tricky and would be nice if we just had one way to access the value

@@ -66,7 +66,10 @@ protected RestController controller() {
protected void dispatchRequest(RestRequest request) {
FakeRestChannel channel = new FakeRestChannel(request, false, 1);
ThreadContext threadContext = new ThreadContext(Settings.EMPTY);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to create this anymore

Suggested change
ThreadContext threadContext = new ThreadContext(Settings.EMPTY);

@pgomulka pgomulka merged commit 5d71612 into elastic:7.x Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/REST API REST infrastructure and utilities Team:Core/Infra Meta label for core/infra team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants