sadanand48 commented on code in PR #4054:
URL: https://github.com/apache/ozone/pull/4054#discussion_r1045446903


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineManagerImpl.java:
##########
@@ -697,6 +698,28 @@ public Map<String, Integer> getPipelineInfo() throws 
NotLeaderException {
     return pipelineInfo;
   }
 
+  @Override
+  public Map<String, String[]> getPipelineLeaders() throws NotLeaderException {
+    final Map<String, String[]> pipelineInfo = new HashMap<>();
+    List<Pipeline> pipelines = getPipelines();
+    pipelines.forEach(pipeline -> {
+      String leaderNode = "";
+      UUID pipelineId = pipeline.getId().getId();
+
+      try {
+        leaderNode = pipeline.getLeaderNode().getHostName();
+      } catch (IOException ioEx) {
+        LOG.warn("Cannot get leader node for pipeline {}",
+            pipelineId, ioEx);
+      }
+      String[] info = {pipeline.getReplicationConfig().toString(), leaderNode};

Review Comment:
   This would work right now but one small improvement here would be to send 
the complete list of nodes for the pipeline along with the roles similar to 
`ozone admin roles cmd`. This way if UI wants to display more information, it 
can directly obtain from this jmx endpoint.
   Something like 
   ```bash
   key: pipelineID
   value : [{ ozone_datanode1 ,  Role : LEADER },{ ozone_datanode2,  Role : 
FOLLOWER},{ ozone_datanode3 ,  Role : FOLLOWER }]
   ```



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