devmadhuu commented on code in PR #8125:
URL: https://github.com/apache/ozone/pull/8125#discussion_r2009509066
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java:
##########
@@ -584,29 +583,28 @@ public Response getContainerMisMatchInsights(
new ArrayList<>();
Long minContainerID = prevKey + 1;
Iterator<ContainerInfo> scmNonDeletedContainers =
- containerManager.getContainers().stream()
- .filter(containerInfo -> (containerInfo.getContainerID()
>= minContainerID))
- .filter(containerInfo -> containerInfo.getState() !=
HddsProtos.LifeCycleState.DELETED)
-
.sorted(Comparator.comparingLong(ContainerInfo::getContainerID)).iterator();
- ContainerInfo scmContainerInfo = scmNonDeletedContainers.hasNext() ?
- scmNonDeletedContainers.next() : null;
+
containerManager.getContainerInfoIterator(ContainerID.valueOf(minContainerID),
+ containerInfo -> containerInfo.getState() !=
HddsProtos.LifeCycleState.DELETED);
+ ContainerInfo scmContainerInfo = scmNonDeletedContainers.hasNext() ?
scmNonDeletedContainers.next() : null;
DataFilter dataFilter = DataFilter.fromValue(missingIn.toUpperCase());
try (SeekableIterator<Long, ContainerMetadata> omContainers =
- reconContainerMetadataManager.getContainersIterator()) {
+ reconContainerMetadataManager.getContainersIterator()) {
omContainers.seek(minContainerID);
- ContainerMetadata containerMetadata = omContainers.hasNext() ?
omContainers.next() : null;
+
switch (dataFilter) {
case SCM:
List<ContainerMetadata> notSCMContainers = new ArrayList<>();
- while (containerMetadata != null && notSCMContainers.size() < limit) {
- Long omContainerID = containerMetadata.getContainerID();
+ while (omContainers.hasNext() && notSCMContainers.size() < limit) {
+ Long omContainerID = omContainers.peekNextKey();
Long scmContainerID = scmContainerInfo == null ? null :
scmContainerInfo.getContainerID();
if (omContainerID.equals(scmContainerID)) {
- containerMetadata = omContainers.hasNext() ? omContainers.next() :
null;
+ omContainers.seek(omContainerID + 1);
scmContainerInfo = scmNonDeletedContainers.hasNext() ?
scmNonDeletedContainers.next() : null;
} else if (scmContainerID == null ||
omContainerID.compareTo(scmContainerID) < 0) {
- notSCMContainers.add(containerMetadata);
- containerMetadata = omContainers.hasNext() ? omContainers.next() :
null;
+ ContainerMetadata omContainer = omContainers.next();
+ if (omContainer.getNumberOfKeys() > 0) {
Review Comment:
Ok, yes , thanks for clarifying. So you are counting number of keys per
container from `ContainerKeyPrefix` in next() of `getContainersIterator` as I
can see in code.
--
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]