shuan1026 opened a new pull request, #11038: URL: https://github.com/apache/ozone/pull/11038
## What changes were proposed in this pull request? `ContainerEndpoint.getBlocks` called `OmKeyLocationInfoGroup.getLocationList()` and then `stream().filter().collect(toList())` on the result, allocating two throwaway lists per key just to walk each block once. `getLocationList()` is documented as expensive: it flattens `locationVersionMap.values()` into a brand-new `List` on every call, instead of the O(1) `getLocationLists()` accessor. This PR rewrites `getBlocks` to iterate `getLocationLists()` directly with a nested loop and an inline containerID check, removing both list allocations. Same pattern already used by `KeyManagerImpl.refreshPipeline` (HDDS-5384). Output ordering and contents are unchanged. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-16202 ## How was this patch tested? Existing tests cover `getBlocks` through the Recon `GET /api/v1/containers/:id/keys` endpoint, including block-id and pagination assertions. The following test suite passed (2 tests): - `TestContainerEndpoint#testGetKeysForContainer` - `TestContainerEndpoint#testGetKeysForContainerWithPrevKey` Also ran `checkstyle.sh` and `author.sh` successfully. -- 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]
