shuan1026 opened a new pull request, #11064:
URL: https://github.com/apache/ozone/pull/11064

   ## What changes were proposed in this pull request?
   
   `S3MultipartUploadCompleteRequest.getMultipartDataSize` calls 
`OmKeyLocationInfoGroup.getLocationList()` twice for the same version group per 
MPU part: once to set `partNumber` on each block, and again to `addAll` those 
same blocks into `partLocationInfos`. `getLocationList()` is documented as 
expensive: it flatten-copies `locationVersionMap.values()` into a brand-new 
`ArrayList` on every call. Since `OmKeyLocationInfo` is a mutable object, the 
second call re-flattens the same data the first call already produced, just to 
read it once more.
   
   Replaces both calls with a single `getLocationLists()` walk of the live, 
uncopied `Collection<List<OmKeyLocationInfo>>` view of 
`locationVersionMap.values()`, setting `partNumber` and doing `addAll` in one 
pass per inner list. Zero list copies instead of two, same `forEach` idiom as 
before.
   
   Same accessor-usage fix already applied in `KeyManagerImpl.refreshPipeline` 
(HDDS-5384), `ContainerEndpoint.getBlocks` (HDDS-16202), and 
`ContainerToKeyMapping.getContainers` (HDDS-16204). Behavior and ordering are 
unchanged.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16205
   
   ## How was this patch tested?
   
   The following test suites passed (16 tests):
   
   - TestS3MultipartUploadCompleteRequest
   - TestS3MultipartUploadCompleteRequestWithFSO
   
   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]

Reply via email to