You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/04/06 14:42:08 UTC

[GitHub] [ozone] sodonnel commented on a diff in pull request #3276: HDDS-6555. Container Deletion should not depend on usedBytes being zero

sodonnel commented on code in PR #3276:
URL: https://github.com/apache/ozone/pull/3276#discussion_r844035952


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1053,6 +1054,18 @@ private void deleteInternal(Container container, boolean force)
               "Deletion of Open Container is not allowed.",
               DELETE_ON_OPEN_CONTAINER);
         }
+        // Safety check that the container is empty.
+        // If the container is not empty, it should not be deleted unless the
+        // container is beinf forcefully deleted (which happens when
+        // container is unhealthy or over-replicated).
+        if (container.getContainerData().getBlockCount() != 0) {

Review Comment:
   It would be good to add a unit test on the DN side to validate that non-empty containers cannot be deleted, just incase someone makes changes in the future that breaks / removes this logic.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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