You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "xichen01 (via GitHub)" <gi...@apache.org> on 2023/06/05 18:15:39 UTC
[GitHub] [ozone] xichen01 commented on a diff in pull request #4800: HDDS-8729. Add metrics for count of pending Block on DN
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org