Huang Kuan Hao created HDDS-16217:
-------------------------------------

             Summary: Avoid the flatten-and-regroup in the OmKeyInfo copy 
constructor
                 Key: HDDS-16217
                 URL: https://issues.apache.org/jira/browse/HDDS-16217
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Huang Kuan Hao
            Assignee: Huang Kuan Hao


OmKeyInfo.Builder(OmKeyInfo) copies each version by passing getLocationList() 
to the (long, List, boolean) constructor, which immediately regroups the 
flattened list back into a version map — so the flatten is pure overhead:

obj.keyLocationVersions.forEach(keyLocationVersion ->
    this.omKeyLocationInfoGroups.add(
        new OmKeyLocationInfoGroup(keyLocationVersion.getVersion(),
            keyLocationVersion.getLocationList(),
            keyLocationVersion.isMultipartKey())));
Fix: pass new HashMap<>(keyLocationVersion.getLocationVersionMap()) to the 
map-taking constructor — this skips the flatten-and-regroup while keeping the 
map spine independent from the source. Behavior unchanged.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to