Skip to content

Conversation

@ArafatKhan2198
Copy link
Contributor

@ArafatKhan2198 ArafatKhan2198 commented Jun 12, 2023

What changes were proposed in this pull request?

In the modified code, the pagination and filtering logic is applied to : getContainerMisMatchInsights()

For the notSCMContainers list (OM containers not in SCM):

  • If prevKey is greater than 0, the method finds the index of the next container after prevKey and retrieves the sublist from that index up to the specified limit.
  • If prevKey is negative, we return NOT_ACCEPTABLE

For the nonOMContainers list (SCM containers not in OM):

  • Similar to the previous section, the pagination logic is applied to retrieve the sublist of containers based on the prevKey and limit.

Filter Parameter:

  • The missingIn filter parameter is used in the getContainerMisMatchInsights method to specify whether the returned container discrepancies should be based on containers missing in the Ozone Manager (OM) or the Storage Container Manager (SCM).

Response Type:

  • The return type of the method has been changed to Response containing a map. The map includes two entries: prevKey and missingContainerList.

Final Response

{
  "lastKey": <containerID>,
  "containerDiscrepancyInfo": [
    {
      "containerId": <containerID>,
      "numberOfKeys": <numberOfKeys>,
      "pipelines": [
        {
          // Pipeline details
        },
        ...
      ],
      "existsAt": "<existsAt>"
    },
    ...
  ]
}

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-8701

How was this patch tested?

Manual Testing and Unit Testing

@adoroszlai adoroszlai marked this pull request as draft June 12, 2023 08:32
@adoroszlai
Copy link
Contributor

@ArafatKhan2198 there are checkstyle violations, please check

hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java
 70: Using the '.*' form of import should be avoided - java.util.*.
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/TestContainerEndpoint.java
 103: Using the '.*' form of import should be avoided - org.junit.Assert.*.

https://github.com/ArafatKhan2198/ozone/actions/runs/5241259025/jobs/9463120676#step:6:529

@ArafatKhan2198
Copy link
Contributor Author

ArafatKhan2198 commented Jun 12, 2023

@devmadhuu @sumitagrawl @dombizita Can you please look !

@ArafatKhan2198 ArafatKhan2198 marked this pull request as ready for review June 12, 2023 08:46
@ArafatKhan2198 ArafatKhan2198 marked this pull request as draft June 12, 2023 08:47
@ArafatKhan2198 ArafatKhan2198 marked this pull request as ready for review June 12, 2023 09:37
@ArafatKhan2198 ArafatKhan2198 requested a review from devmadhuu June 12, 2023 14:15
@sumitagrawl sumitagrawl self-requested a review June 14, 2023 09:46
@ArafatKhan2198
Copy link
Contributor Author

@devmadhuu @sumitagrawl review changes have been made!

Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArafatKhan2198 thanks for working over this, given few comments.

Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArafatKhan2198 Thanks for working, LGTM +1

Copy link
Contributor

@devmadhuu devmadhuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArafatKhan2198 Thanks for working. LGTM +1

Copy link
Contributor

@ashishkumar50 ashishkumar50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArafatKhan2198, Thanks for working on this, overall PR LGTM. Left two comments.

@sumitagrawl sumitagrawl changed the title HDDS-8701 Recon - Improve Mismatched container info API (containers/v1/mismatch). HDDS-8701. Recon - Improve Mismatched container info API (containers/v1/mismatch). Jun 19, 2023
Copy link
Contributor

@dombizita dombizita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for working on this @ArafatKhan2198, overall it looks good to me, please address the comments by @ashishkumar50, those are good catches.
also I just saw you renamed the prevKey to lastKey, may I ask why? prevKey is used often in the Recon code, also in your patch still at several places. I'd go with prevKey, the constants are also named in that way.

@ArafatKhan2198
Copy link
Contributor Author

thanks for working on this @ArafatKhan2198, overall it looks good to me, please address the comments by @ashishkumar50, those are good catches.
also I just saw you renamed the prevKey to lastKey, may I ask why? prevKey is used often in the Recon code, also in your patch still at several places. I'd go with prevKey, the constants are also named in that way.

Thank you for reviewing the code and providing your feedback. Regarding the renaming of prevKey to lastKey, I understand your concern. However, please note that the lastKey you mentioned is not used as a query parameter in the endpoint. It is used as part of the JSON response to implement pagination.

When the getContainerMisMatchInsights method is called, the result is returned, and the last container ID is included in the JSON response as lastKey. This lastKey is not related to the query parameter used in the API endpoint.

Subsequently, when the next set of results is fetched by calling getContainerMisMatchInsights again, the prevKey query parameter will be set as the lastKey response parameter from the previous response, so as to facilitate pagination.
And putting lastKey in the response makes more sense as it will contain the container ID of the last record fetched by the API call.

@dombizita dombizita requested review from ashishkumar50 and devmadhuu and removed request for ashishkumar50 and devmadhuu June 19, 2023 14:38
Copy link
Contributor

@ashishkumar50 ashishkumar50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArafatKhan2198, Thanks for updating patch, LGTM +1.

Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ArafatKhan2198 LGTM +1

@dombizita dombizita merged commit ff7bab0 into apache:master Jun 20, 2023
@dombizita
Copy link
Contributor

thanks for working on this @ArafatKhan2198! thanks for the review @ashishkumar50, @devmadhuu and @sumitagrawl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants