ivandika3 commented on code in PR #6960:
URL: https://github.com/apache/ozone/pull/6960#discussion_r1683708446


##########
hadoop-hdds/server-scm/src/main/resources/webapps/scm/scm-overview.html:
##########
@@ -153,6 +155,35 @@ <h2>Meta-Data Volume Information</h2>
     </tbody>
 </table>
 
+<h2>SCM Roles (HA)</h2>
+<h4 ng-show="$ctrl.overview.jmx.RatisRoles.length == 1 && 
$ctrl.overview.jmx.RatisRoles[0].length == 
1">{{$ctrl.overview.jmx.RatisRoles[0][0]}}</h4>

Review Comment:
   This part seems to be taken from https://github.com/apache/ozone/pull/5311, 
but I don't think this applies here. From my understanding this is to handle 
when there are exceptions when calling `OzoneManager#getRatisRoles`, but 
`StorageContainerManager#getRatisRoles` do not throw such exceptions. It might 
be safe to remove this for SCM since it doesn't throw exceptions.
   
   I noticed there are some differences in the implementation of 
`StorageContainerManager#getRatisRoles` and `OzoneManager#getRatisRoles`. We 
might need to unify the logics.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java:
##########
@@ -2136,6 +2136,23 @@ public String getScmRatisRoles() {
         HddsUtils.format(server.getRatisRoles()) : "STANDALONE";
   }
 
+  @Override
+  public List<List<String>> getRatisRoles() {
+    final SCMRatisServer server = getScmHAManager().getRatisServer();
+    List<String> ratisRoles = server.getRatisRoles();
+    List<List<String>> result = new ArrayList<>();
+    for (String role : ratisRoles) {
+      String[] roleArr = role.split(":");
+      List<String> scmInfo = new ArrayList<>();
+      scmInfo.add(roleArr[0]);
+      scmInfo.add(roleArr[3]);
+      scmInfo.add(roleArr[1]);
+      scmInfo.add(roleArr[2]);
+      result.add(scmInfo);
+    }

Review Comment:
   Seems `SCMRatisServerImpl#getRatisRoles` might return empty string if 
`RaftPeer#getAddress` is null (maybe in the case of SCM STANDALONE setup) which 
might trigger index exception. Let's handle it just in case, both here and in 
`scm-overview.html`.



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