Repository navigation
HDDS-17135. Bracket IPv6 literals passed to NetUtils.createSocketAddr and in Recon datanode JMX URLs - #11619
Merged
Conversation
… and in Recon datanode JMX URLs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gargi-jais11
left a comment
Contributor
There was a problem hiding this comment.
Thanks @smengcl for the patch.
Left one comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks @Gargi-jais11 for reviewing this. Would you like to take another look? |
Gargi-jais11
marked this pull request as ready for review
October 21, 2026 04:09
Gargi-jais11
approved these changes
Oct 21, 2026
Gargi-jais11
left a comment
Contributor
There was a problem hiding this comment.
Thanks @smengcl for updating the patch.
LGTM, +1!
Contributor
Author
|
Thanks @Gargi-jais11 for the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
Several production paths pass a host that can be a bare IPv6 literal to
NetUtils.createSocketAddr(target, defaultPort), or format it into a URL without brackets. Hadoop parsestargetas a URI authority, so a bare literal such as2001:db8::10throwsIllegalArgumentException: Does not contain a valid host:port authority. Bare literals reach these paths because SCM records a datanode's IP withInetAddress.getHostAddress()(and its hostname is the literal when there is no reverse DNS), andNodeDetailstakes its host address fromInetSocketAddress.getHostName().Affected paths:
NodeDetails.getRpcAddress(): OM bootstrap (checkRemoteOMConfig,addOMToRatisRing) throws when the remote OM's host address is a bare literal.SCMHANodeDetails.loadSCMHAConfig: SCM HA fails to start with an unbracketedozone.scm.address.<serviceId>.<nodeId>, althoughvalidateAdvertisedHostaccepts it.XceiverClientManager.getPipelineCacheKeyandXceiverClientShortCircuit: with short circuit reads enabled, every non EC read from an IPv6 datanode fails.DataNodeMetricsCollectionTask(Recon): the datanode JMX URL is malformed, so pending deletion metrics are reported as -1.DiskBalancerSubCommandUtil.getSingleNodeDiskBalancerProxy: any:was taken to mean "port given", so[2001:db8::1]threw instead of using the default port, and a bare literal failed with an unhelpful error.ozone local: with--host ::1, service addresses, the Recon endpoint and the startup summary became::1:9860.The fix combines host and port with
HddsUtils.getHostPortString, and parses the DiskBalancer and SCM HA addresses withHddsUtils.getHostName/getHostPort. These bracket IPv6 literals and accept DNS names, IPv4 literals and already bracketed input. This follows the same pattern as HDDS-15773 and HDDS-16831.The DiskBalancer CLI now rejects an unbracketed IPv6 address, because
2001:db8::1:1234could mean either a host with port 1234 or a whole literal. It usesHddsUtils.validateHostPortAuthority(now public), the same checkozone.scm.namesandozone.recon.addressuse, and the error message suggests the bracketed form to use.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17135
How was this patch tested?
New unit tests. The bare IPv6 cases fail without the fix; the DNS, IPv4 and bracketed cases guard against regressions:
TestOMNodeDetails: unbracketed IPv6 host address.TestSCMConfiguration: SCM HA peer with unbracketed and bracketed IPv6 address.TestDataNodeMetricsCollectionTask(new): JMX URL for a DNS name and an IPv6 literal over HTTP and HTTPS.TestDiskBalancerSubCommandUtil: address parsing for IPv4 and bracketed IPv6, with and without a port, and rejection of unbracketed IPv6 with and without a trailing port.TestLocalOzoneClusterandTestOzoneLocal: service addresses, Recon endpoint and startup summary with--host ::1.🤖 Generated with Claude Code