This is an automated email from the ASF dual-hosted git repository.

bharat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 6239270  HDDS-5724. Add RaftpeerId when getting scm roles (#2622)
6239270 is described below

commit 623927039f3ac16ae4ab6e4a4a2f423e6885892d
Author: Nibiru <[email protected]>
AuthorDate: Thu Sep 9 19:10:47 2021 +0800

    HDDS-5724. Add RaftpeerId when getting scm roles (#2622)
---
 .../java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java     | 3 ++-
 .../apache/hadoop/ozone/admin/scm/GetScmRatisRolesSubcommand.java  | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
index e5fe91b..f639300 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
@@ -257,7 +257,8 @@ public class SCMRatisServerImpl implements SCMRatisServer {
       ratisRoles.add((peer.getAddress() == null ? "" :
               peer.getAddress().concat(isLocal ?
                   ":".concat(RaftProtos.RaftPeerRole.LEADER.toString()) :
-                  ":".concat(RaftProtos.RaftPeerRole.FOLLOWER.toString()))));
+                  ":".concat(RaftProtos.RaftPeerRole.FOLLOWER.toString()))
+                  .concat(":".concat(peer.getId().toString()))));
     }
     return ratisRoles;
   }
diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/scm/GetScmRatisRolesSubcommand.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/scm/GetScmRatisRolesSubcommand.java
index c784c44..16fbc68 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/scm/GetScmRatisRolesSubcommand.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/scm/GetScmRatisRolesSubcommand.java
@@ -29,7 +29,8 @@ import picocli.CommandLine;
  */
 @CommandLine.Command(
     name = "roles",
-    description = "List all SCMs and their respective Ratis server roles",
+    description = "List all SCMs, their respective Ratis server roles " +
+        "and RaftPeerIds",
     mixinStandardHelpOptions = true,
     versionProvider = HddsVersionProvider.class)
 public class GetScmRatisRolesSubcommand extends ScmSubcommand {
@@ -40,6 +41,8 @@ public class GetScmRatisRolesSubcommand extends ScmSubcommand 
{
   @Override
   protected void execute(ScmClient scmClient) throws IOException {
     List<String> roles = scmClient.getScmRatisRoles();
-    System.out.println(roles);
+    for (String role: roles) {
+      System.out.println(role);
+    }
   }
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to