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: [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]