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



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/CloseContainerEventHandler.java
##########
@@ -85,9 +85,11 @@ public void onMessage(ContainerID containerID, 
EventPublisher publisher) {
         command.setTerm(scmContext.getTermOfLeader());
         command.setEncodedToken(getContainerToken(containerID));
 
-        getNodes(container).forEach(node ->
-            publisher.fireEvent(DATANODE_COMMAND,
-                new CommandForDatanode<>(node.getUuid(), command)));
+        getNodes(container).forEach(node -> {
+          publisher.fireEvent(DATANODE_COMMAND,
+                new CommandForDatanode<>(node.getUuid(), command));
+        });
+

Review comment:
       Let's remove unnecessary changes in this file.

##########
File path: 
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NodeEndpoint.java
##########
@@ -108,6 +115,10 @@ public Response getDatanodes() {
           if (datanode.getUuid().equals(pipeline.getLeaderId())) {
             leaderCount.getAndIncrement();
           }
+          int openContainerPerPipeline =
+                  reconContainerManager.getPipelineToOpenContainer()
+                  .getOrDefault(pipelineID, 0);
+          openContainers.set(openContainers.get() + openContainerPerPipeline);

Review comment:
       Doesn't seem atomic to me.. Try this?
   ```suggestion
             openContainers.getAndAdd(openContainerPerPipeline);
   ```

##########
File path: 
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/NodeEndpoint.java
##########
@@ -108,6 +115,10 @@ public Response getDatanodes() {
           if (datanode.getUuid().equals(pipeline.getLeaderId())) {
             leaderCount.getAndIncrement();
           }
+          int openContainerPerPipeline =
+                  reconContainerManager.getPipelineToOpenContainer()
+                  .getOrDefault(pipelineID, 0);

Review comment:
       What is the rationale behind defaulting to pipeline ID `0` here? 
Wouldn't `get(pipelineID)` be better?




-- 
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:
[email protected]



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

Reply via email to