siddhantsangwan commented on code in PR #4967:
URL: https://github.com/apache/ozone/pull/4967#discussion_r1243306663
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerManagerImpl.java:
##########
@@ -144,55 +143,23 @@ public ContainerInfo getContainer(final ContainerID id)
public List<ContainerInfo> getContainers(final ContainerID startID,
final int count) {
scmContainerManagerMetrics.incNumListContainersOps();
- final List<ContainerID> containersIds =
- new ArrayList<>(containerStateManager.getContainerIDs());
- Collections.sort(containersIds);
- List<ContainerInfo> containers;
- lock.lock();
- try {
- containers = containersIds.stream()
- .filter(id -> id.compareTo(startID) >= 0).limit(count)
- .map(containerStateManager::getContainer)
- .collect(Collectors.toList());
- } finally {
- lock.unlock();
- }
- return containers;
+ return toContainers(filterSortAndLimit(startID, count,
Review Comment:
I noticed that this method's interface javadoc says the List should not
include the `startID`.
```
/**
* Returns containers under certain conditions.
* Search container IDs from start ID(exclusive),
* The max size of the searching range cannot exceed the
* value of count.
```
The previous implementation also includes the `startID`, so perhaps we
should edit the javadoc.
--
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]