amaliujia commented on code in PR #12056:
URL: https://github.com/apache/ozone/pull/12056#discussion_r4582293183


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/ClosePipelineCommandHandler.java:
##########
@@ -159,10 +157,9 @@ public void handle(SCMCommand<?> command, OzoneContainer 
ozoneContainer,
                           raftGroupId, pipelineID, peer, ioe);
                     }
                   });
+              // Remove group locally, might throw GroupMismatchException as 
well.
+              ratisServer.removeGroup(pipelineID.getGroupId());

Review Comment:
   Can we reuse `raftGroupId` above?



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java:
##########
@@ -114,16 +115,15 @@ public void handle(SCMCommand<?> command, OzoneContainer 
ozoneContainer,
         switch (container.getContainerState()) {
         case OPEN:
         case CLOSING:
-          // If the container is part of open pipeline, close it via
-          // write channel
-          if (ozoneContainer.getWriteChannel()
-              .isExist(closeCommand.getPipelineID())) {
+          final PipelineID pipelineID = 
PipelineID.getFromProtobuf(closeCommand.getPipelineID());

Review Comment:
   The `CloseContainerCommand` is holding a PipelineID already: 
https://github.com/apache/ozone/blob/c0c487daa5925bf0e847780404aa70cc158d9f0b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CloseContainerCommand.java#L33
   
   Can we do `final PipelineID pipelineID = ((CloseContainerCommand) 
command).getPipelineID();` to avoid the price of deserializing the pipeline id 
from proto again?
   
   It seems also fine for such cast based on existing code: 
https://github.com/apache/ozone/blob/master/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java#L95-L96
   



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