xichen01 commented on code in PR #8767:
URL: https://github.com/apache/ozone/pull/8767#discussion_r2199489880


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java:
##########
@@ -326,9 +337,18 @@ public void close() {
   }
 
   private void getTransaction(DeletedBlocksTransaction tx,
-      DatanodeDeletedBlockTransactions transactions,
-      Set<ContainerReplica> replicas,
-      Map<DatanodeID, Map<Long, CmdStatus>> commandStatus) {
+                                       DatanodeDeletedBlockTransactions 
transactions,
+                                       Set<ContainerReplica> replicas,
+                                       Map<DatanodeID, Map<Long, CmdStatus>> 
commandStatus) {
+
+    // Check if all replicas satisfy the maxBlocksPerDatanode condition
+    if (!replicas.stream().allMatch(replica -> {

Review Comment:
   And if the ((DN count) * maxDeleteBlocksPerDatanode) < blockDeletionLimit, 
the DeletedBlockLogImpl#getTransactions will iterator all the data in the table.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java:
##########
@@ -326,9 +337,18 @@ public void close() {
   }
 
   private void getTransaction(DeletedBlocksTransaction tx,
-      DatanodeDeletedBlockTransactions transactions,
-      Set<ContainerReplica> replicas,
-      Map<DatanodeID, Map<Long, CmdStatus>> commandStatus) {
+                                       DatanodeDeletedBlockTransactions 
transactions,
+                                       Set<ContainerReplica> replicas,
+                                       Map<DatanodeID, Map<Long, CmdStatus>> 
commandStatus) {
+
+    // Check if all replicas satisfy the maxBlocksPerDatanode condition
+    if (!replicas.stream().allMatch(replica -> {

Review Comment:
   If the deleted replicas are not distributed evenly, this return may cause 
the blockDeletionLimit hard to be reached (such as: in an expanded cluster, the 
deleted data may be on the old DNs.).
   Maybe we can set a maximum number of loop, e.g. end the while loop in 
`DeletedBlockLogImpl#getTransactions` if it exceeds 3 * (DN count) * 
maxDeleteBlocksPerDatanode.



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