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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/AbstractContainerReportHandler.java:
##########
@@ -357,21 +357,21 @@ private boolean updateContainerState(final 
DatanodeDetails datanode,
        * 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.
+       * HDDS-12421: If a DELETING or DELETED container has a non-empty 
replica, the container should also be moved
+       * back to CLOSED state.
        */
-
       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) {
+        // should we send a non-force delete instead?
         deleteReplica(containerId, datanode, publisher, "DELETED");
         ignored = true;
         break;
       }
 
-      boolean replicaStateAllowed = replica.getState() == State.CLOSED;
-      boolean replicaNotEmpty = replica.hasIsEmpty() && !replica.getIsEmpty();
-      if (replicaStateAllowed && replicaNotEmpty) {
+      boolean replicaStateAllowed = (replica.getState() != State.INVALID && 
replica.getState() != State.DELETED);

Review Comment:
   @siddhantsangwan btw this change failed 
`ecContainerShouldTransitionFromDeletingToClosedWhenNonEmptyClosedReplica`:
   
   ```
   2025-02-28 16:17:50,365 [main] INFO  container.ContainerReportHandler 
(AbstractContainerReportHandler.java:updateContainerState(374)) - Moving 
container ContainerInfo{id=#7540283255775332556, state=DELETING, 
stateEnterTime=2025-03-01T00:17:50.311Z, 
pipelineID=PipelineID=198dc161-f620-4be8-83ce-8125701a2f59, owner=TEST} from 
DELETING to CLOSED state, datanode localhost-130.203.243.102 reported replica 
with state=CLOSING, isEmpty=false, bcsId=0, keyCount=0, and 
origin=ead52188-b54d-43aa-8cf4-e9bc63230b88
   ```
   
   Pls double check if this is the desired behavior. (Transitions DELETING EC 
container straight to CLOSED after receiving a CLOSING replica report, which 
sounds fine to me.)



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