AdyChechani commented on code in PR #10831:
URL: https://github.com/apache/ozone/pull/10831#discussion_r3668369982


##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeCheckSubcommand.java:
##########
@@ -104,16 +104,16 @@ private SCMNodeInfo findLeaderNode(ScmClient scmClient) 
throws IOException {
     try {
       List<String> roles = scmClient.getScmRoles();
       for (String role : roles) {
-        String[] parts = role.split(":");
-        if (parts.length < 3 || !"LEADER".equalsIgnoreCase(parts[2])) {
+        String[] parts = HddsUtils.parseRatisRoleString(role);
+        if (!"LEADER".equalsIgnoreCase(parts[2])) {
           continue;
         }
         String leaderHost = parts[0];
-        String leaderIp = parts.length >= 5 ? parts[4] : null;
+        String leaderIp = parts[4];
         for (SCMNodeInfo node : nodes) {
-          String nodeHost = node.getScmClientAddress().split(":")[0];
+          String nodeHost = 
HddsUtils.getHostName(node.getScmClientAddress()).orElse("");

Review Comment:
   it now extracts hosts via `HddsUtils.getHostName()` (IPv6-safe), compares 
them as strings first, and falls back to `InetAddress.getByName()` resolution 
for IPv6 equivalence (compressed vs expanded forms). Ports are also compared 
when both inputs include them.



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