chihsuan opened a new pull request, #10807:
URL: https://github.com/apache/ozone/pull/10807

   ## What changes were proposed in this pull request?
   
   **Problem.** `ServerNotLeaderException` builds and parses its 
suggested-leader address with IPv6-unsafe code on both sides of the protocol. 
The server joins host and port with a plain colon (`suggestedLeader + ":" + 
port`), so an IPv6 literal produces an ambiguous string such as 
`2001:db8::1:9872` that address parsers reject. The client regex 
`([^:]*)(:[0-9]+)` rejects colons in the host, so an IPv6 authority never 
matches. As a result `getSuggestedLeader()` silently returns null in IPv6 
deployments and the failover proxy falls back to round-robin probing, losing 
the fast-path leader hint.
   
   **Fix.** Both sides change together:
   
   - Server side: build the suggested-leader `host:port` with 
`HddsUtils.getHostPortString` (from HDDS-15768), which brackets IPv6 literals.
   - Client side: extend `SUGGESTED_LEADER_PATTERN` to accept a bracketed IPv6 
authority in addition to the existing host form.
   - `SCMFailoverProxyProviderBase.performFailoverToAssignedLeader` now 
resolves the suggested leader with `NetUtils.createSocketAddr` and matches on 
`InetSocketAddress` equality instead of string comparison, so bracketed and 
bare forms normalize; an unparseable hint is logged and ignored rather than 
throwing.
   
   Found while reviewing HDDS-15773; excluded there because the server string 
and client regex have to change in the same patch.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15895
   
   ## How was this patch tested?
   
   - Added a unit test that converts a `NotLeaderException` with an IPv6 leader 
and asserts the built message round-trips back to `[2001:db8::1]:9863` through 
the parsing constructor.
   - Added a wired failover test asserting the proxy provider maps a bracketed 
IPv6 suggested leader to the correct SCM nodeId and fails over to it; this test 
fails against the pre-fix string comparison.
   - `TestServerNotLeaderExceptionMessageParsing` (2/2) and 
`TestSCMFailoverProxyProviderRefreshWired` (6/6) pass locally.
   


-- 
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]

Reply via email to