sumitagrawl commented on code in PR #9147:
URL: https://github.com/apache/ozone/pull/9147#discussion_r2449005462
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerSet.java:
##########
@@ -409,13 +417,19 @@ public Iterator<Map.Entry<Long, Long>>
getRecoveringContainerIterator() {
*/
public Iterator<Container<?>> getContainerIterator(HddsVolume volume) {
Preconditions.checkNotNull(volume);
- Preconditions.checkNotNull(volume.getStorageID());
- String volumeUuid = volume.getStorageID();
- return containerMap.values().stream()
- .filter(x -> volumeUuid.equals(x.getContainerData().getVolume()
- .getStorageID()))
- .sorted(ContainerDataScanOrder.INSTANCE)
- .iterator();
+ Iterator<Long> containerIdIterator = volume.getContainerIterator();
Review Comment:
similar optimization is required for
org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer#gatherContainerUsages,
```
AtomicLong usages = new AtomicLong();
Iterator<Long> containerIdIterator =
storageVolume.getContainerIterator();
while (containerIdIterator.hasNext()) {
Container<?> container =
containerSet.getContainer(containerIdIterator.next());
if (container != null) {
usages.addAndGet(container.getContainerData().getBytesUsed());
}
}
return usages.get();
```
--
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]