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

Add toXContent and fromXContent for DiscoveryNode and DiscoveryNodes #13576

Closed

Conversation

shiv0408
Copy link
Member

@shiv0408 shiv0408 commented May 7, 2024

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

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created

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.

Copy link
Contributor

github-actions bot commented May 7, 2024

❌ 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?

Copy link
Contributor

github-actions bot commented May 7, 2024

❌ 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?

Copy link
Contributor

github-actions bot commented May 7, 2024

❕ Gradle check result for 93d13e2: UNSTABLE

  • TEST FAILURES:
      1 org.opensearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT.test {yaml=search.aggregation/230_composite/composite aggregation date_histogram profile shows filter rewrite info}

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@shiv0408
Copy link
Member Author

shiv0408 commented May 7, 2024

SmokeTestMultiNodeClientYamlTestSuiteIT test has been identified as flaky previously in #9332

Copy link
Member

@dbwiddis dbwiddis left a 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.

@lukas-vlcek
Copy link
Contributor

@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?).

Copy link
Contributor

❌ 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?

@github-actions github-actions bot added Cluster Manager enhancement Enhancement or improvement to existing feature or request labels May 15, 2024
@shiv0408
Copy link
Member Author

@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.

@shiv0408
Copy link
Member Author

shiv0408 commented May 15, 2024

@dbwiddis Thanks for reviewing the changes. I have pushed a commit to address your concerns. Can you please take another look at the changes?

Also I've seen the method you call fromXContent called parse()

We are consistently using fromXContent method name for de-serializing the object for all the objects with are getting used in our remote cluster state flow.

Copy link
Contributor

❌ 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]>
Copy link
Contributor

❌ 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?

Copy link
Contributor

github-actions bot commented Jun 4, 2024

❌ 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]>
Copy link
Contributor

github-actions bot commented Jun 5, 2024

✅ Gradle check result for 2d2127e: SUCCESS

* 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 {
Copy link
Member

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.

@shwetathareja
Copy link
Member

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.

@shiv0408
Copy link
Member Author

shiv0408 commented Jun 7, 2024

Closing this as we are not gonna be using XContent for storing cluster state ephemeral objects brings overhead in maintenance of writeTo, readFrom and toXContent with additional fromXContent. We have added RemoteWriteableEntity with ser/de that can be done with InputStream as well.
So, discarding this PR and other ephemeral objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cluster Manager enhancement Enhancement or improvement to existing feature or request skip-changelog
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[Remote Cluster State] Add toXContent and fromXContent for DiscoveryNodes
5 participants