Skip to content

Dry up AcknowledgedResponse Handling #63335

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

Merged

Conversation

original-brownbear
Copy link
Member

Motivated by the fact that we keep adding more and more master node actions that return an ack response:

  1. AcknowledgedResponse should really be two singletons to make things clearer and save some objects and code size.
  2. We were duplicating reading this type over and over in a bunch of transport master node actions so I dried that up

1. `AcknowledgedResponse` should really be two singletons to make things clearer and save some objects and code size.
2. We were duplicating reading this type over and over  in a bunch of transport master node actions so I dried that up
@elasticmachine
Copy link
Collaborator

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

@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Oct 6, 2020
@original-brownbear
Copy link
Member Author

Jenkins run elasticsearch-ci/packaging-sample-windows

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM


import java.io.IOException;

public abstract class AcknowledgedTransportMasterNodeAction<Request extends MasterNodeRequest<Request>>
Copy link
Member

Choose a reason for hiding this comment

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

short javadoc?

Copy link
Member Author

Choose a reason for hiding this comment

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

added :)

@original-brownbear
Copy link
Member Author

Thanks Ryan!

@original-brownbear original-brownbear merged commit 4e740c2 into elastic:master Oct 9, 2020
@original-brownbear original-brownbear deleted the singleton-ack-response branch October 9, 2020 06:52
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 9, 2020
1. It is confusing and unnecessary to handle response deserialization via inheritance
and request deserialization via composition. Consistently using composition saves
hundreds of lines of code and as a matter of fact also removes some indirection in
transport master node action since we pass a reader down to the response handling anyway.
2. Defining `executor` via inheritance but then assuming the return of the method is a constant
is confusing and again not in line with how we handle the `executor` definition for other transport
actions so this was simplified away as well.

Somewhat relates to the dry-up in elastic#63335
original-brownbear added a commit that referenced this pull request Oct 12, 2020
1. It is confusing and unnecessary to handle response deserialization via inheritance
and request deserialization via composition. Consistently using composition saves
hundreds of lines of code and as a matter of fact also removes some indirection in
transport master node action since we pass a reader down to the response handling anyway.
2. Defining `executor` via inheritance but then assuming the return of the method is a constant
is confusing and again not in line with how we handle the `executor` definition for other transport
actions so this was simplified away as well.

Somewhat relates to the dry-up in #63335
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 14, 2020
These intermediary response types don't contain any information
outside of what the shard acknowledged and acknowledged responses
contain so this PR removes them.
Also, it adds three constants for the three possible states of
`ShardsAcknowledgedResponse`.

Follow up to elastic#63335
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 26, 2020
1. `AcknowledgedResponse` should really be two singletons to make things clearer and save some objects and code size.
2. We were duplicating reading this type over and over  in a bunch of transport master node actions so I dried that up
original-brownbear added a commit that referenced this pull request Oct 26, 2020
1. `AcknowledgedResponse` should really be two singletons to make things clearer and save some objects and code size.
2. We were duplicating reading this type over and over  in a bunch of transport master node actions so I dried that up
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 26, 2020
1. It is confusing and unnecessary to handle response deserialization via inheritance
and request deserialization via composition. Consistently using composition saves
hundreds of lines of code and as a matter of fact also removes some indirection in
transport master node action since we pass a reader down to the response handling anyway.
2. Defining `executor` via inheritance but then assuming the return of the method is a constant
is confusing and again not in line with how we handle the `executor` definition for other transport
actions so this was simplified away as well.

Somewhat relates to the dry-up in elastic#63335
original-brownbear added a commit that referenced this pull request Oct 26, 2020
1. It is confusing and unnecessary to handle response deserialization via inheritance
and request deserialization via composition. Consistently using composition saves
hundreds of lines of code and as a matter of fact also removes some indirection in
transport master node action since we pass a reader down to the response handling anyway.
2. Defining `executor` via inheritance but then assuming the return of the method is a constant
is confusing and again not in line with how we handle the `executor` definition for other transport
actions so this was simplified away as well.

Somewhat relates to the dry-up in #63335
original-brownbear added a commit that referenced this pull request Nov 3, 2020
These intermediary response types don't contain any information
outside of what the shard acknowledged and acknowledged responses
contain so this PR removes them.
Also, it adds three constants for the three possible states of
`ShardsAcknowledgedResponse`.

Follow up to #63335
original-brownbear added a commit that referenced this pull request Nov 10, 2020
These intermediary response types don't contain any information
outside of what the shard acknowledged and acknowledged responses
contain so this PR removes them.
Also, it adds three constants for the three possible states of
`ShardsAcknowledgedResponse`.

Follow up to #63335
@original-brownbear original-brownbear restored the singleton-ack-response branch December 6, 2020 19:02
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 >non-issue Team:Core/Infra Meta label for core/infra team v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants