-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add toXContent and fromXContent for DiscoveryNode and DiscoveryNodes #13576
Add toXContent and fromXContent for DiscoveryNode and DiscoveryNodes #13576
Conversation
❌ Gradle check result for 5870c05: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
5870c05
to
7d1a599
Compare
❌ Gradle check result for 7d1a599: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
7d1a599
to
93d13e2
Compare
❕ Gradle check result for 93d13e2: UNSTABLE
Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
|
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 few comments.
Also I've seen the method you call fromXContent
called parse()
. Since it's a static method and not enforced by the interface, in theory you can make it whatever you want... I see a lot of both throughout the codebase so either is probably fine, but I'd suggest making this consistent with other code around where it will be used... if that's fromXContent()
that's fine, I haven't dug into the context.
libs/core/src/main/java/org/opensearch/core/common/transport/TransportAddress.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/cluster/node/DiscoveryNode.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/opensearch/cluster/node/DiscoveryNodeTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/opensearch/cluster/node/DiscoveryNodesTests.java
Show resolved
Hide resolved
@shiv0408 Would you mind modifying issue description and adding a ticket number that requires this change please? I would be interested in learning more about why exactly this is needed (I assume this is relevant to remote storage?). |
❌ Gradle check result for f151e00: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Shivansh Arora <[email protected]>
f151e00
to
6a54fb1
Compare
@lukas-vlcek apologies for late response, I have modified the description of the PR to include the issue for this. And yes, this effort is required for remote state publication. |
@dbwiddis Thanks for reviewing the changes. I have pushed a commit to address your concerns. Can you please take another look at the changes?
We are consistently using |
❌ Gradle check result for 6a54fb1: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
- Add java docs for fromString method in TransportAddress - Cleaned up toXContent methods in DiscoveryNode, DiscoveryNodes Signed-off-by: Shivansh Arora <[email protected]>
6a54fb1
to
08a10cb
Compare
❌ Gradle check result for 08a10cb: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for a33fe7b: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Shivansh Arora <[email protected]>
a33fe7b
to
2d2127e
Compare
* Converts a string in the format [hostname/ip]:[port] into a transport address. | ||
* @throws UnknownHostException if the hostname or ip address is invalid | ||
*/ | ||
public static TransportAddress fromString(String address) throws UnknownHostException { |
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.
You don't control the toString() you are using TransportAddress.toString()
which calls NetworkAddress.format(address);
. If toString() implementation changes, your fromString() will break.
As discussed, it may not be scalable to keep on adding fromXContent to ephemeral objects which only have StreamInput/ StreamOutput implementation for node to node cluster state publication. Lets use that only serde. Also for other objects like ClusterState.Custom or Metadata.Custom where plugins can provides custom implementations, they may not have fromXContent method implemented and then it will break the remote state which is not desired. |
Closing this as we are not gonna be using XContent for storing cluster state ephemeral objects brings overhead in maintenance of |
Description
We need to upload the DiscoveryNodes object to remote to enable the cluster state publication flow from remote. To do that we need to parse DiscoveryNodes object to and from XContent.
Related Issues
Resolves #13691
Meta issue #13683
Check List
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.