Skip to content

HDDS-15895. Make ServerNotLeaderException suggested leader flow IPv6-safe#10807

Open
chihsuan wants to merge 2 commits into
apache:masterfrom
chihsuan:HDDS-15895
Open

HDDS-15895. Make ServerNotLeaderException suggested leader flow IPv6-safe#10807
chihsuan wants to merge 2 commits into
apache:masterfrom
chihsuan:HDDS-15895

Conversation

@chihsuan

@chihsuan chihsuan commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

ServerNotLeaderException carries the SCM suggested-leader address through its exception message. The IPv6 fast path was broken at three points:

  1. The server joined host and port with a plain colon, producing an ambiguous value such as 2001:db8::1:9863.
  2. The client-side regex rejected colons in the host, so reconstructing the exception through Hadoop RPC returned no suggested leader.
  3. The failover proxy compared formatted address strings. Even after parsing a bracketed IPv6 authority, the comparison could still fail because equivalent IPv6 addresses may use compressed and expanded text forms.

This change fixes the complete flow:

  • Build the suggested-leader authority with HddsUtils.getHostPortString, producing [2001:db8::1]:9863 for IPv6 while leaving hostname and IPv4 output unchanged.
  • Extend SUGGESTED_LEADER_PATTERN to accept bracketed IPv6 without changing the existing non-IPv6 parsing behavior.
  • Parse the suggested leader with NetUtils.createSocketAddr and match it against the configured SCM InetSocketAddress instead of comparing strings.
  • Log and ignore an unparseable suggested-leader hint, preserving the existing round-robin fallback rather than interrupting failover.

The result is that IPv6 clients can use the suggested-leader fast path instead of probing SCM nodes in round-robin order.

This issue was found while reviewing HDDS-15773 and kept separate because the message producer, parser, and functional consumer need to change together.

What is the link to the Apache JIRA?

https://issues.apache.org/jira/browse/HDDS-15895

How was this patch tested?

  • Added an IPv6 conversion and message round-trip test for ServerNotLeaderException.

  • Added a wired three-SCM failover test where the suggested leader is not the next round-robin node. This verifies that the IPv6 hint selects the intended SCM instead of passing accidentally through normal round-robin failover.

  • Ran:

    mvn -pl :hdds-common test -Dtest=TestServerNotLeaderExceptionMessageParsing -DskipShade -DskipRecon -DskipDocs
    mvn -pl :hdds-server-framework test -Dtest=TestSCMFailoverProxyProviderRefreshWired -DskipShade -DskipRecon -DskipDocs
    mvn -pl :hdds-common,:hdds-server-framework checkstyle:check -DskipShade -DskipRecon -DskipDocs

Generated-by: Claude Code (Claude Opus 4.8)

Copilot AI review requested due to automatic review settings July 19, 2026 03:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 19, 2026 03:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chihsuan
chihsuan marked this pull request as ready for review July 19, 2026 04:10
Copilot AI review requested due to automatic review settings July 19, 2026 04:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jojochuang
jojochuang requested a review from smengcl July 20, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants