siddhantsangwan commented on code in PR #7976:
URL: https://github.com/apache/ozone/pull/7976#discussion_r1972868378


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/AbstractContainerReportHandler.java:
##########
@@ -352,26 +352,22 @@ private boolean updateContainerState(final 
DatanodeDetails datanode,
        */
       break;
     case DELETING:
+    case DELETED:
       /*
-      HDDS-11136: If a DELETING container has a non-empty CLOSED replica, the 
container should be moved back to CLOSED
-      state.
+       * HDDS-11136: If a DELETING container has a non-empty CLOSED replica, 
the container should be moved back to
+       * CLOSED state.
+       *
+       * HDDS-12421: If a DELETED container has a non-empty CLOSED replica, 
the container should also be moved back to
+       * CLOSED state.
        */
       boolean replicaStateAllowed = replica.getState() == State.CLOSED;
       boolean replicaNotEmpty = replica.hasIsEmpty() && !replica.getIsEmpty();
       if (replicaStateAllowed && replicaNotEmpty) {
-        logger.info("Moving DELETING container {} to CLOSED state, datanode {} 
reported replica with state={}, " +
-            "isEmpty={} and keyCount={}.", containerId, 
datanode.getHostName(), replica.getState(), false,
-            replica.getKeyCount());
-        containerManager.transitionDeletingToClosedState(containerId);
+        logger.info("Moving container {} from {} to CLOSED state, datanode {} 
reported replica with state={}, " +

Review Comment:
   "Container state": state of `ContainerInfo` in SCM
   "Replica state": state of the replica in DN
   
   EDIT: We may need to transition the container back to QUASI_CLOSED, because 
the container was incorrectly in the CLOSED state in the first place. I take 
back the sentence below.
   For a container to go into the `DELETING` state in the first place, it's 
required to be in the `CLOSED` state. Since it's guaranteed that the container 
was `CLOSED`, we need to transition the container back to that state only.
   
   
   ```
   boolean replicaStateAllowed = replica.getState() == State.CLOSED;
   ```
   But the replica could be in any state in this particular case, not just 
`CLOSED`, right? 
   
   > as long as the replica is not unhealthy
   
   Even if the replica is `UNHEALTHY` but not empty, I suppose we still want to 
transition the container back to `CLOSED`? And let replication manager make 
multiple copies of that replica. The scanner may have marked it as UNHEALTHY 
but it may still have mostly good data.



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