-
Notifications
You must be signed in to change notification settings - Fork 59
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
New Design with createComponent extension point #8
New Design with createComponent extension point #8
Conversation
63c65f2
to
c1070df
Compare
src/main/java/org/opensearch/sdk/ClusterStateResponseHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/sdk/ClusterSettingResponseHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/sdk/ClusterStateResponseHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/sdk/ClusterStateResponseHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/sdk/ClusterStateResponseHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/sdk/ClusterSettingResponseHandler.java
Outdated
Show resolved
Hide resolved
dca68bc
to
102a416
Compare
src/main/java/org/opensearch/sdk/ClusterSettingResponseHandler.java
Outdated
Show resolved
Hide resolved
|
||
public class ClusterSettingResponseHandler implements TransportResponseHandler<ClusterSettingsResponse> { | ||
private static final Logger logger = LogManager.getLogger(ClusterSettingResponseHandler.class); | ||
final CountDownLatch inProgressLatch = new CountDownLatch(1); |
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.
Does this need to be package private to be read outside this class? If not, it should be private (same question/comment elsewhere in this PR.)
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.
What is the purpose of this object, it doesn't seem to be impacted flow of control? Here is a stack overflow answer about CountDownLatch's 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.
private static ExtensionSettings extensionSettings = null; | ||
private DiscoveryNode opensearchNode = null; | ||
TransportService transportService = null; |
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.
We are still using a TransportService argument in other methods like startTransportService()
. I see in this comment it's "available when needed" but there is no getter for it and we are not ever using it.
It happens to be "available" package private, but is that intentional? Given that you've added a public setter for it, should it be private with a getter since otherwise we're setting it and forgetting it (other than perhaps the reference to it from a reachability perspective)?
Also, this same variable name is used as a local variable later in createTransportService()
and main()
. That's not a good idea.
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.
Good call! Made transportService private and created a getter for the same.
src/main/java/org/opensearch/sdk/ExtensionClusterStateResponseHandler.java
Outdated
Show resolved
Hide resolved
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.
TLDR: I'm not sure what the right answer is with TransportService, but I don't think what we have is it.
That pesky TransportService instance variable needs a bit more careful thought and handling here. You're both setting it and returning it with the create()
method, and elsewhere using both effects (return and instance) interchangeably.
If we need to keep the same API (with a return value from create*()
and an argument to start*()
) then we should find a more consistent way to work within those constraints (perhaps not have the instance variable and require the user to create and then pass it).
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
a47512e
to
ebeda8a
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 did one pass, tiny comments so far.
|
||
@Override | ||
public void handleResponse(ClusterSettingsResponse response) { | ||
logger.info("received {}", response); |
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.
Lets make this log at debug level?
src/main/java/org/opensearch/sdk/ExtensionClusterStateResponseHandler.java
Outdated
Show resolved
Hide resolved
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.
WIth adding API support for createComponent, can you add unit tests ?
Abstracted into APIs. Will add tests together as a part of #25 |
Signed-off-by: Owais Kazi <[email protected]>
e74de57
to
ba1ec1e
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.
Thanks for taking care of the comments.
Looks like CI is failing, like due to change not merged to feature/extensions branch on OpenSearch?
Yes. Build will fail as this PR has dependency on opensearch-project/OpenSearch#3265. Update: PR got merged and the build passed. |
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.
Approved but I really want some placeholder (comment, TODO, log warning, something) about making sure the opensearchNode
isn't null before using it. Go ahead and add as an addition for a later issue if needed, just don't want it forgotten.
Signed-off-by: Owais Kazi <[email protected]>
8335be7
* Draft createComponent extension point Signed-off-by: Owais Kazi <[email protected]> * Resolved issue of transport stopped Signed-off-by: Owais Kazi <[email protected]> * Decoupled response handler to separate classes Signed-off-by: Owais Kazi <[email protected]> * Addressed PR Comments Signed-off-by: Owais Kazi <[email protected]> * Removed CountDown Latch Signed-off-by: Owais Kazi <[email protected]> * Refactoring and PR comments Signed-off-by: Owais Kazi <[email protected]> * Addressed PR Comments Signed-off-by: Owais Kazi <[email protected]> * Abstracted send request to APIs Signed-off-by: Owais Kazi <[email protected]> * Added comment for OpenSearchNode Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi [email protected]
Description
Part of opensearch-project/OpenSearch#2981
Also, resolves #6
Note: Build will fail as this PR has dependency on opensearch-project/OpenSearch#3265.
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.