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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/AbstractContainerReportHandler.java:
##########
@@ -352,26 +352,31 @@ 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 DELETING or DELETED container has a non-empty 
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);
+      boolean replicaIsEmpty = replica.hasIsEmpty() && replica.getIsEmpty();
+      // If container is in DELETED state and the reported replica is empty, 
delete the empty replica.
+      // We should also do this for DELETING containers and currently 
DeletingContainerHandler does that
+      if (container.getState() == HddsProtos.LifeCycleState.DELETED && 
replicaIsEmpty) {
+        deleteReplica(containerId, datanode, publisher, "DELETED", false);
+        ignored = true;

Review Comment:
   Since we are not doing a force delete. Let's remove this. This replica will 
never be tracked otherwise. @errose28 correct me if I am wrong here.



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