You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/03/29 22:24:47 UTC

[GitHub] [ozone] avijayanhwx commented on a change in pull request #2094: HDDS-5022. SCM get roles command should provide Ratis Leader/Follower…

avijayanhwx commented on a change in pull request #2094:
URL: https://github.com/apache/ozone/pull/2094#discussion_r603651548



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
##########
@@ -225,7 +225,7 @@ public void stop() throws IOException {
   @Override
   public List<String> getRatisRoles() {
     return division.getGroup().getPeers().stream()
-        .map(peer -> peer.getAddress() == null ? "" : peer.getAddress())
+        .map(peer -> peer.getAddress() == null ? "" : peer.getAddress().concat(peer.getAdminAddress() == null ? ":FOLLOWER" : ":LEADER"))

Review comment:
       I am not sure if we should rely on the getAdminAddress() call to be null to determine if this node is LEADER or FOLLOWER. Can we do something similar to OM? The SCM that is returning the answer will be leader (since read calls go only to Leader), and the other nodes will be followers. 

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
##########
@@ -225,7 +225,7 @@ public void stop() throws IOException {
   @Override
   public List<String> getRatisRoles() {
     return division.getGroup().getPeers().stream()
-        .map(peer -> peer.getAddress() == null ? "" : peer.getAddress())
+        .map(peer -> peer.getAddress() == null ? "" : peer.getAddress().concat(peer.getAdminAddress() == null ? ":FOLLOWER" : ":LEADER"))

Review comment:
       Also, can we use org.apache.ratis.proto.RaftProtos.RaftPeerRole#LEADER/FOLLOWER instead of hardcoded strings?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org