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

RestController not using thread context directly from thread pool #74293

Merged
merged 2 commits into from
Jun 23, 2021

Conversation

pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Jun 18, 2021

At the moment thread context is passed via dispatchRequest but in some
places thread context is fetched directly from thread pool
This is not a problem in production, because thread pool is initialized
with the same thread context as the one passed to dispatchRequest via
AbstractHttpServerTransport.
It might be harder to understand though and might cause problems in
testing in smaller units.

relates #74230 (comment)

At the moment thread context is passed via dispatchRequest but in some
places thread context is fetched directly from thread pool
This is not a problem in production, because thread pool is initialized
with the same thread context as the one passed to dispatchRequest via
AbstractHttpServerTransport.
It might be harder to understand though and might cause problems in
testing in smaller units.
@pgomulka pgomulka self-assigned this Jun 18, 2021
@pgomulka pgomulka added the :Core/Infra/Core Core issues without another label label Jun 18, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jun 18, 2021
@elasticmachine
Copy link
Collaborator

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

Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

LGTM, though I'd like if we reverted unrelated test changes (they're nice but should go into a separate PR IMO) :)

.build();
dispatchRequest(request);
assertWarnings(RestGetSourceAction.TYPES_DEPRECATION_MESSAGE);
for (RestRequest.Method method : Arrays.asList(RestRequest.Method.GET, RestRequest.Method.HEAD)) {
Copy link
Member

Choose a reason for hiding this comment

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

These test changes while nice aren't really related to the rest of the PR, maybe revert those to keep the change isolated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea, I will revert the test cases and will follow up in a separate PR

@pgomulka pgomulka merged commit c6c662d into elastic:master Jun 23, 2021
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Jun 23, 2021
…astic#74293)

At the moment thread context is passed via dispatchRequest but in some
places thread context is fetched directly from thread pool
This is not a problem in production, because thread pool is initialized
with the same thread context as the one passed to dispatchRequest via
AbstractHttpServerTransport.
It might be harder to understand though and might cause problems in
testing in smaller units.
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Jun 23, 2021
Refactoring RestGetActionTests and RestGestSourceActionTests to remove
duplicated code. Previously the tests would fail if rest request was
sent twice to RestController. This was fixed in elastic#74293 and the
refactoring is possible now
pgomulka added a commit that referenced this pull request Jun 23, 2021
…kport(#74293) #74488

At the moment thread context is passed via dispatchRequest but in some
places thread context is fetched directly from thread pool
This is not a problem in production, because thread pool is initialized
with the same thread context as the one passed to dispatchRequest via
AbstractHttpServerTransport.
It might be harder to understand though and might cause problems in
testing in smaller units.
backports #74293
pgomulka added a commit that referenced this pull request Jun 24, 2021
Refactoring RestGetActionTests and RestGestSourceActionTests to remove
duplicated code. Previously the tests would fail if rest request was
sent twice to RestController. This was fixed in #74293 and the
refactoring is possible now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >enhancement Team:Core/Infra Meta label for core/infra team v7.14.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants