ChenSammi commented on a change in pull request #2548:
URL: https://github.com/apache/ozone/pull/2548#discussion_r690911646



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerController.java
##########
@@ -44,6 +47,8 @@
 
   private final ContainerSet containerSet;
   private final Map<ContainerType, Handler> handlers;
+  private static final Logger LOG =
+          LoggerFactory.getLogger(ContainerController.class);

Review comment:
       The indent of wrapped line is 4 space instead of 8.  This is a general 
code style of ozone. 

##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerController.java
##########
@@ -79,9 +84,18 @@ public String getContainerLocation(final long containerId) {
   public void markContainerForClose(final long containerId)
       throws IOException {
     Container container = containerSet.getContainer(containerId);
-
-    if (container.getContainerState() == State.OPEN) {
-      getHandler(container).markContainerForClose(container);
+    if (container==null) {

Review comment:
       Please leave a space before and after the == operation.  This is also a 
general code style in Ozone.

##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerController.java
##########
@@ -44,6 +47,8 @@
 
   private final ContainerSet containerSet;
   private final Map<ContainerType, Handler> handlers;
+  private static final Logger LOG =
+          LoggerFactory.getLogger(ContainerController.class);

Review comment:
       The indent of wrapped line is 4 space instead of 8.  This is a general 
code style of ozone.  Kindly also check the other part of the code which 
involes wrapped lines. 

##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerController.java
##########
@@ -79,9 +84,18 @@ public String getContainerLocation(final long containerId) {
   public void markContainerForClose(final long containerId)
       throws IOException {
     Container container = containerSet.getContainer(containerId);
-
-    if (container.getContainerState() == State.OPEN) {
-      getHandler(container).markContainerForClose(container);
+    if (container==null) {

Review comment:
       Please leave a space before and after the operator, such as ==, + , - , 
etc.  This is also a general code style in Ozone.

##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerController.java
##########
@@ -79,9 +84,18 @@ public String getContainerLocation(final long containerId) {
   public void markContainerForClose(final long containerId)
       throws IOException {
     Container container = containerSet.getContainer(containerId);
-
-    if (container.getContainerState() == State.OPEN) {
-      getHandler(container).markContainerForClose(container);
+    if (container==null) {
+      Set<Long> missingContainerSet = containerSet.getMissingContainerSet();
+      if (missingContainerSet.contains(containerId)) {
+        LOG.warn("The Container is in the MissingContainerSet " +
+                "hence we can't close it. ContainerID: {}", containerId);
+      } else {
+        LOG.warn("The Container is not found. ContainerID: {}", containerId);
+      }
+    } else {
+      if (container.getContainerState() == State.OPEN) {
+        getHandler(container).markContainerForClose(container);
+      }

Review comment:
       This is an usually case that container is not found.  I would suggest 
throw an container not found storage exception here,  the outer has the logic 
to handle the exception.  
   




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