linyiqun commented on a change in pull request #1338:
URL: https://github.com/apache/hadoop-ozone/pull/1338#discussion_r496544696



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ReplicationManager.java
##########
@@ -320,6 +331,12 @@ private void processContainer(ContainerID id) {
        * exact number of replicas in the same state.
        */
       if (isContainerHealthy(container, replicas)) {
+        /*
+         *  If container is empty, schedule task to delete the container.
+         */
+        if (isContainerEmpty(container, replicas)) {
+          deleteContainerReplicas(container, replicas);
+        }

Review comment:
       @ChenSammi , Is there any specific reason that we let ReplicationManager 
to help clean empty containers?  After this, ReplicaManager will do 
additionally container empty check for all healthy containers. Not sure if this 
is an efficiency way to put logic here.
   >I wonder if it would be simpler to remove empty containers as part of 
Container Report processing? In 
AbstractContainerReportHandler#updateContainerState, we could check the size 
and number of keys of the reported containers in the CLOSED branch of the 
switch statement, and then take action to delete an empty container there? I 
have a feeling it might be simpler, but I am not sure. The disadvantage of 
doing it in the Container Report Processing, is that we are dealing with only a 
single replica at that stage. However if the container is CLOSED in SCM, and a 
report says it is empty then we should be good to simply remove the container 
from SCM and issue the delete container command when processing the container 
report.
   
   Actually I prefer this way as @sodonnel mentioned.
   >but I am not sure. The disadvantage of doing it in the Container Report 
Processing, is that we are dealing with only a single replica at that stage
   
   
   We could also get all replica info and check state in 
ContainerReportHandler, then send delete container command
   
   I'm okay for current way but just share my thought for this.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to