-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
revamp TransportRequest handlers to support Writeable #26315
revamp TransportRequest handlers to support Writeable #26315
Conversation
638fbef
to
43fd46a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments. Looks good in general.
@@ -41,7 +42,7 @@ | |||
|
|||
import static org.elasticsearch.ingest.IngestDocument.MetaData; | |||
|
|||
public class SimulatePipelineRequest extends ActionRequest { | |||
public class SimulatePipelineRequest extends ActionRequest implements Writeable { | |||
|
|||
private String id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can all become final
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not, because of the client usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if the transport-client request builder pattern is to be deprecated, I think it may be best for that to be done in its own context in separate PRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, I could not see all the setters in the review without expanding.
|
||
private TransportAddress remoteAddress; | ||
|
||
public TransportMessage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a single, explicit empty ctor should not be necessary (that is what the default ctor is)
@@ -39,6 +39,11 @@ | |||
public TransportRequest() { | |||
} | |||
|
|||
public TransportRequest(StreamInput in) throws IOException { | |||
super(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicit call to default ctor is not necessary
public void testUnsupportedReadFrom() { | ||
SimulatePipelineRequest request = new SimulatePipelineRequest(); | ||
Exception exception = expectThrows(UnsupportedOperationException.class,() -> request.readFrom(null)); | ||
assertThat(exception.getMessage(), equalTo("usage of Streamable is to be replaced by Writeable")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be adding a test for each one of these. It is not part of our API (that these are returning UOE).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK cool. I was on the fence about it. figured I'd discuss it after the work has been done :) will happily remove
1fa601e
to
51885b3
Compare
This PR begins the long journey to deprecating Streamable. The idea here is to add additional method signatures that support Writeable.Reader, so that the work to migrate objects TransportMessage to implement Writeable and not Streamable. One example conversion is done in this PR: SimulatePipelineRequest.
51885b3
to
ccf5717
Compare
thanks, updated with changes reflecting the review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Awesome! I'm sorry I missed this yesterday. I'm excited to see the start. |
@talevy Is it possible to backport this to 6.x? |
I suppose, I guess I didn't think about it since it was a work-in-progress transitional interface. If you think I should, I'd be happy to. I can imagine one would want to leverage the writeable interface in new actions in 7.0 that need to be backported to 6.x, so these aspects of the constructor could potentially cause merging issues? Is this what you are referring to? |
@talevy. Yes, this actually happened to me. I was using a new API in V7 but had to use the old one for 6.x. |
Backport of PR to 6.x, excluding the changes to SimulatePipelineRequest
Backport of PR to 6.x, excluding the changes to SimulatePipelineRequest
-- This is a pre-stage for adding the reindex API to the REST high-level-client -- Follows the pattern set in #26315
-- This is a pre-stage for adding the reindex API to the REST high-level-client -- Follows the pattern set in #26315
This PR begins the long journey to deprecating Streamable.
The idea here is to add additional method signatures that
support Writeable.Reader, so that the work to migrate objects TransportMessage to
implement Writeable and not Streamable.
One example conversion is done in this PR: SimulatePipelineRequest.