srinireddy2020 commented on code in PR #6456:
URL: https://github.com/apache/hbase/pull/6456#discussion_r2299796068


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java:
##########
@@ -1496,6 +1505,32 @@ protected void handleReportForDutyResponse(final 
RegionServerStartupResponse c)
     }
   }
 
+  /**
+   * Normalizes an IPv6 address string by removing leading and trailing square 
brackets if present,
+   * returning the canonical IPv6 address form.
+   * <p>
+   * This method is intended to convert IPv6 addresses from URI or config 
contexts, where brackets
+   * may be used, into a format accepted by standard Java networking APIs.
+   * <p>
+   * Examples:
+   *
+   * <pre>
+   *   normalizeIPv6Address("[2001:db8::1]") returns "2001:db8::1"
+   *   normalizeIPv6Address("2001:db8::1")  returns "2001:db8::1"
+   *   normalizeIPv6Address("[::1]")        returns "::1"
+   * </pre>
+   *
+   * @param address the input IPv6 address, possibly with square brackets
+   * @return the normalized IPv6 address string without brackets
+   */
+  private String normalizeIPv6Address(String address) {

Review Comment:
   Normalization is required to remove leading and trailing square brackets 
from IPv6 addresses, since HMaster expects RegionServer IPs without brackets; 
this ensures consistent recognition and handling in cluster operations. Only 
this formatting case needs to be addressed here only for compatibility. 
   Rest of the operations are working correctly even IP is with Brackets.
   
   Example log message for information
   " Master passed us a different hostname to use; was=[::1], but now=::1"
   
   code ref: 
https://github.com/apache/hbase/blob/95bd8a3da87e8c106e4eedec1726234681b7d859/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java#L1421



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

Reply via email to