chihsuan opened a new pull request, #10804: URL: https://github.com/apache/ozone/pull/10804
## What changes were proposed in this pull request? This change makes `HddsUtils` host:port handling IPv6-safe. `getHostName()` previously removed a trailing `:port` with a regex. This left brackets in `[::1]:9862` and corrupted bare IPv6 literals such as `::1` or `2001:db8::1`. `getScmAddressForClients()` then rebuilt addresses using `host + ":" + port`, which creates an ambiguous address for IPv6 hosts. This patch: - Uses Guava `HostAndPort` in `getHostName()`, matching the adjacent `getHostPort()` helper and returning unbracketed IPv6 hosts. - Uses `getHostPortString()` to rebuild SCM client addresses, producing valid bracketed IPv6 addresses such as `[2001:db8::1]:9860`. - Removes the unused `HddsUtils.format(List<String>)` method. It has no repository callers and parses role strings with IPv6-unsafe fixed-colon splitting. Malformed host:port inputs, including `a:b`, `host:99999`, and unbracketed IPv6-with-port values, now throw `IllegalArgumentException`. This matches `getHostPort()` and the documented contract of `getHostNameFromConfigKeys()`. The fixed-index role parsing in `StorageContainerManager#getScmRatisRoles()` (HDDS-15774) and the `ServerNotLeaderException` suggested-leader flow (HDDS-15895) remain out of scope and require separate follow-up changes. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-15773 ## How was this patch tested? - Added `TestHddsUtils#testGetHostName` coverage for bracketed and bare IPv6 literals, IPv6 without a port, and malformed input. - Added `TestHddsClientUtils` coverage for IPv6 SCM client addresses and the `ozone.scm.names` fallback path. - `hdds-common` module unit tests: 404 tests passed. - `TestHddsClientUtils`: passed. - `checkstyle.sh`, `rat.sh`, and `author.sh`: passed. - `mvn clean install -DskipTests`: passed. Generated-by: Claude Code (Opus 4.8) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
