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/06/10 18:23:01 UTC

[GitHub] [ozone] vivekratnavel commented on a change in pull request #2321: HDDS-5314. Show number of Open vs Closed containers per Node in Recon UI

vivekratnavel commented on a change in pull request #2321:
URL: https://github.com/apache/ozone/pull/2321#discussion_r649418700



##########
File path: hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NodeEndpoint.java
##########
@@ -117,11 +123,26 @@ public Response getDatanodes() {
         }
       });
       try {
-        int containers = nodeManager.getContainers(datanode).size();
+        Set<ContainerID> allContainers = nodeManager.getContainers(datanode);
+
+        int openContainers = 0;
+        for (ContainerID containerID: allContainers) {
+          ContainerInfo containerInfo = reconContainerManager.getContainer(containerID);
+          if (containerInfo.isOpen()) {
+            ++openContainers;
+          }
+        }
+
+        int containers = allContainers.size();
+        int closedContainers = containers - openContainers;
         builder.withContainers(containers);
+        builder.withOpenContainers(openContainers);
+        builder.withClosedContainers(closedContainers);
       } catch (NodeNotFoundException ex) {
         LOG.warn("Cannot get containers, datanode {} not found.",
             datanode.getUuid(), ex);
+      } catch (ContainerNotFoundException cnfe) {
+        LOG.warn("Cannot found container.", cnfe);

Review comment:
       nit: 
   ```suggestion
           LOG.warn("Cannot find container.", cnfe);
   ```




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