Xushaohong commented on code in PR #4655:
URL: https://github.com/apache/ozone/pull/4655#discussion_r1185658173


##########
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:
   Why the container is considered to be empty when it is not open?  It is 
common that the container has blocks when it transitions into states like  
CLOSING.



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