HDDS-16139. Define and enforce OFS and O3FS IPv6 authority contracts - #11108
HDDS-16139. Define and enforce OFS and O3FS IPv6 authority contracts#11108echonesis wants to merge 2 commits into
Conversation
chihsuan
left a comment
There was a problem hiding this comment.
Thanks @echonesis Overall, this looks good. I left a few inline comments, mostly around error classification and test scope.
I also noticed other related IPv6 issues (getHttpAddressForOMPeerNode and getHttpsAddressForOMPeerNode) in the same file. The fix would be the same approach used elsewhere in this PR.
Would it make sense to fold those in here, or should they go on a separate Jira under the epic?
ozone/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
Lines 618 to 620 in d3198e4
| hostCaptor.capture(), anyInt()); | ||
| assertNull(hostCaptor.getValue()); | ||
| assertEquals("[2001:db8::10]:9862", | ||
| OmUtils.getOmRpcAddress(confCaptor.getValue())); |
There was a problem hiding this comment.
This assertion tests OmUtils, which TestOmUtils already covers. I wonder if we should instead assert what createAdapter receives to keep this test focused on O3FS behavior?
There was a problem hiding this comment.
Agreed. I removed the OmUtils assertion and now verify directly that createAdapter receives the original configuration, the expected bucket and volume, a null OM host, and port -1. The IPv6 formatting behavior remains covered by TestOmUtils.
| public void testO3fsConfiguredIpv6Endpoint() throws Exception { | ||
| OzoneConfiguration conf = new OzoneConfiguration(); | ||
| conf.set(OMConfigKeys.OZONE_OM_ADDRESS_KEY, | ||
| "[2001:db8::10]:9862"); |
There was a problem hiding this comment.
nit: these lines fit within the 120-character limit. Could remain on one line, consistent with the test above?
There was a problem hiding this comment.
Agreed. I kept the affected statements on one line since they fit within the 120-character limit and match the surrounding tests.
| throw new IllegalArgumentException(URI_EXCEPTION_TEXT); | ||
| } | ||
|
|
||
| if (authority.indexOf(':') != authority.lastIndexOf(':')) { |
There was a problem hiding this comment.
This treats any authority with multiple colons as IPv6, so malformed non-IPv6 authorities now get the IPv6-specific error. Could we classify it as IPv6 only after validating the authority shape?
There was a problem hiding this comment.
Good point. I moved the IPv6 classification after the O3FS authority shape parsing and now validate the OM endpoint with InetAddresses.isInetAddress. Valid raw IPv6 literals still receive the targeted IPv6 error, while malformed multi-colon authorities receive the general O3FS URI error. I added regression coverage for both cases.
Thanks @chihsuan |
What changes were proposed in this pull request?
This PR defines and enforces the supported IPv6 authority forms for OFS and O3FS following the URI parser changes in HDDS-15775.
ofs://[2001:db8::10]:9862/.bucket.volume, DNS names, IPv4 addresses, and OM service IDs.o3fs://bucket.volume/when the OM endpoint is supplied through configuration, including a configured bracketed IPv6 address.A dotted O3FS authority cannot contain a bracketed IPv6 literal such as
bucket.volume.[2001:db8::10], becausejava.net.URIrejects that form before O3FS initialization. Therefore, O3FS requires a DNS name or OM service ID when an IPv6 endpoint must be represented in the dotted authority.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16139
How was this patch tested?
Local Test
mvn -pl :ozone-filesystem-common -am test \ -Dtest=TestBasicOzoneFileSystems,TestOmUtils,TestOMFailoverProxyProvider \ -Dsurefire.failIfNoSpecifiedTests=false \ -DskipShade -DskipRecon -DskipDocsGitHub Actions CI: https://github.com/echonesis/ozone/actions/runs/32799667939
Generated-by: Codex (GPT-5)