nandakumar131 commented on a change in pull request #1401: HDDS-1561: Mark OPEN 
containers as QUASI_CLOSED as part of Ratis groupRemove
URL: https://github.com/apache/hadoop/pull/1401#discussion_r320872891
 
 

 ##########
 File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java
 ##########
 @@ -111,10 +111,13 @@ public void handle(SCMCommand command, OzoneContainer 
ozoneContainer,
         return;
       }
       // If we reach here, there is no active pipeline for this container.
-      if (!closeCommand.getForce()) {
-        // QUASI_CLOSE the container.
-        controller.quasiCloseContainer(containerId);
-      } else {
+      if (container.getContainerState() == ContainerProtos.ContainerDataProto
+          .State.OPEN || container.getContainerState() ==
+          ContainerProtos.ContainerDataProto.State.CLOSING) {
+        // Container should not exist in OPEN or CLOSING state without a
+        // pipeline.
+        controller.markContainerUnhealthy(containerId);
+      } else if (closeCommand.getForce()) {
         // SCM told us to force close the container.
         controller.closeContainer(containerId);
       }
 
 Review comment:
   Not exactly related to this patch, but this part of code has become a little 
bit messy.
   We should be able to refactor this.
   ``` 
   switch (container.getContainerState()) {
    case OPEN:
      controller.markContainerForClose(containerId);
    case CLOSING:
      final HddsProtos.PipelineID pipelineID = closeCommand.getPipelineID();
      final XceiverServerSpi writeChannel = ozoneContainer.getWriteChannel();
      if (writeChannel.isExist(pipelineID)) {
        writeChannel.submitRequest(getContainerCommandRequestProto(
            datanodeDetails, containerId), pipelineID);
      } else {
        controller.markContainerUnhealthy(containerId);
      }
      break;
    case QUASI_CLOSED:
      if (closeCommand.getForce()) {
        controller.closeContainer(containerId);
        break;
      }
    case CLOSED:
    case UNHEALTHY:
    case INVALID:
      LOG.debug("Cannot close the container #{}, the container is" +
          " in {} state.", containerId, container.getContainerState());
    }
   ```

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


With regards,
Apache Git Services

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

Reply via email to