navinko commented on code in PR #10993:
URL: https://github.com/apache/ozone/pull/10993#discussion_r3798160209


##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeCheckSubcommand.java:
##########
@@ -82,57 +79,10 @@ public Void call() throws Exception {
   }
 
   private void executeForSingleNode(ScmClient scmClient, ScmNodeTarget 
targetScmNode) throws IOException {
-    SCMNodeInfo targetNode;
-    if (serviceId != null) {
-      // HA mode: find leader
-      targetNode = findLeaderNode(scmClient);
-      if (targetNode == null) {
-        throw new IOException("Could not determine leader node");
-      }
-    } else {
-      // Non-HA mode: use single node
-      targetNode = nodes.get(0);

Review Comment:
   Thanks the PR was in DRAFT and changes in flight .



##########
hadoop-ozone/cli-admin/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeCheckSubcommand.java:
##########
@@ -82,57 +79,10 @@ public Void call() throws Exception {
   }
 
   private void executeForSingleNode(ScmClient scmClient, ScmNodeTarget 
targetScmNode) throws IOException {
-    SCMNodeInfo targetNode;
-    if (serviceId != null) {
-      // HA mode: find leader
-      targetNode = findLeaderNode(scmClient);
-      if (targetNode == null) {
-        throw new IOException("Could not determine leader node");
-      }
-    } else {
-      // Non-HA mode: use single node
-      targetNode = nodes.get(0);
-    }
-    
+    SCMNodeInfo targetNode = nodes.get(0);
     queryNode(scmClient, targetScmNode, targetNode);
   }
 
-  /**
-   * Find the leader node from SCM roles.
-   * @param scmClient the SCM client
-   * @return the leader SCMNodeInfo
-   */
-  private SCMNodeInfo findLeaderNode(ScmClient scmClient) throws IOException {
-    try {
-      List<String> roles = scmClient.getScmRoles();
-      for (String role : roles) {
-        String[] parts;
-        try {
-          parts = HddsUtils.parseRatisRoleString(role);
-        } catch (IllegalArgumentException e) {
-          continue;
-        }
-        if (!"LEADER".equalsIgnoreCase(parts[2])) {
-          continue;
-        }
-        String leaderHost = parts[0];
-        String leaderIp = parts[4];
-        for (SCMNodeInfo node : nodes) {
-          String nodeHost = 
HddsUtils.getHostName(node.getScmClientAddress()).orElse("");
-
-          if (matchesAddress(leaderHost, nodeHost) || (!leaderIp.isEmpty() &&
-                  matchesAddress(leaderIp, nodeHost))) {
-            return node;
-          }
-        }
-      }

Review Comment:
   Thanks the PR was in DRAFT and changes in flight .



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