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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/statemachine/background/BlockDeletingService.java:
##########
@@ -175,13 +175,19 @@ public BackgroundTaskQueue getTasks() {
   public List<ContainerBlockInfo> chooseContainerForBlockDeletion(
       int blockLimit, ContainerDeletionChoosingPolicy deletionPolicy)
       throws StorageContainerException {
+    long[] totalPendingBlockCount = new long[1];
     Map<Long, ContainerData> containerDataMap =
         ozoneContainer.getContainerSet().getContainerMap().entrySet().stream()
             .filter(e -> ((KeyValueContainerData) e.getValue()
                 .getContainerData()).getNumPendingDeletionBlocks() > 0)
             .filter(e -> isDeletionAllowed(e.getValue().getContainerData(),
-                deletionPolicy)).collect(Collectors
+                deletionPolicy))
+            .peek(e -> totalPendingBlockCount[0] +=

Review Comment:
   Do you mean to use `containerDataMap` to do the calculation? which seems 
clearer,  but it may need to iterate through the `Contianer` again if there are 
more Contianers, which may add some processing time.



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