vivekratnavel commented on a change in pull request #954: HDDS-1670. Add limit
support to /api/containers and /api/containers/{id} endpoints
URL: https://github.com/apache/hadoop/pull/954#discussion_r294545140
##########
File path:
hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ContainerDBServiceProviderImpl.java
##########
@@ -181,6 +182,12 @@ public Integer getCountForForContainerKeyPrefix(
Long containerID = keyValue.getKey().getContainerId();
Integer numberOfKeys = keyValue.getValue();
+ // break the loop if limit has been reached
+ // and one more new entity needs to be added to the containers map
+ if (containers.size() == limit && !containers.containsKey(containerID)) {
Review comment:
Without the second condition, the last container ID will have incorrect
number of keys in its containerMetadata. Even when containers limit is reached,
the next iteration could contain the same container ID with a different key
prefix. To handle this situation, we should not break the iterator until the
second condition is also met.
I don't think we need to add any check for any other negative values since
none of them match the condition `containers.size() == limit` at any 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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]