ashishkumar50 commented on code in PR #4655:
URL: https://github.com/apache/ozone/pull/4655#discussion_r1185668569
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/helpers/KeyValueContainerUtil.java:
##########
@@ -392,6 +397,24 @@ private static void
initializeUsedBytesAndBlockCount(DatanodeStore store,
kvData.setBlockCount(blockCount);
}
+ /**
+ * A container is empty if:
+ * - The container is closed
+ * - There are no blocks in its block table.
+ *
+ * Empty containers are eligible for deletion.
+ */
+ public static boolean isEmpty(DatanodeStore store,
+ KeyValueContainerData container) throws IOException {
+ if (container.isOpen()) {
+ return false;
Review Comment:
When container is open it is considered as not empty. When in any other
state(other than open state) we are checking in block table to see if there are
any block present and then we decide container is empty or not.
--
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]