-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-8502. Recon - getContainers API is not giving expected response with prevKey. #4724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@devmadhuu @dombizita @krishnaasawa1 Can you please take a look. |
|
@ArafatKhan2198 thanks for working on this patch, can you also pls add a test case with adding non-sequential container Ids and do all assertions ? |
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/TestContainerEndpoint.java
Show resolved
Hide resolved
ashishkumar50
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ArafatKhan2198, Thanks for working on this. Please find few comments.
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java
Outdated
Show resolved
Hide resolved
ashishkumar50
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating the patch, LGTM.
|
Thanks for updating the patch @ArafatKhan2198 . LGTM +1 |
...op-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ContainersResponse.java
Show resolved
Hide resolved
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java
Show resolved
Hide resolved
|
thanks for the patch @ArafatKhan2198! thanks for the review @ashishkumar50 @devmadhuu! |
What changes were proposed in this pull request?
The
getContainers()method in the container Endpoint has been modified to exclude the container specified by theprevKeyparameter from the list of containers in theContainerResponse.The getContainers() method changes ensure that:
Skipping the container with the same ID as prevKey: The container stream is filtered to exclude the container matching prevKey, ensuring it is not included in the results.
To increase the prevKey by 1: We simply add 1 to the current value of prevKey. This is because the container IDs are arranged in ascending order. By doing this, we remove the first container from the list, which corresponds to the container with a Container ID equal to prevKey. As a result, this prevents that particular container from appearing in the API response.
Providing the last container ID in container API Response: The last container ID is determined based on the fetched container metadata. If no containers were fetched, last container ID is set to prevKey. Otherwise, it is obtained from the ID of the last container in the list. This information enables pagination and using the last container ID as the new prevKey value for subsequent requests.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-8502
How was this patch tested?