Xushaohong commented on code in PR #4655:
URL: https://github.com/apache/ozone/pull/4655#discussion_r1186132844
##########
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:
Got the intention now.
One problem seems to be the inconsistent block count across replicas in some
cases. Using the real block count from DB instead of the in-memory block count
could determine the real block count in the container and then help SCM to
delete empty containers. Is it right?
--
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]