Huang Kuan Hao created HDDS-16212:
-------------------------------------

             Summary: Avoid the per-group list copy in Recon 
ContainerKeyMapperHelper
                 Key: HDDS-16212
                 URL: https://issues.apache.org/jira/browse/HDDS-16212
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Huang Kuan Hao
            Assignee: Huang Kuan Hao


ContainerKeyMapperHelper.handleKeyReprocess and handlePutOMKeyEvent iterate 
getLocationList() for every version group, but the loop body only reads 
getContainerID():

for (OmKeyLocationInfoGroup omKeyLocationInfoGroup : 
omKeyInfo.getKeyLocationVersions()) {
  long keyVersion = omKeyLocationInfoGroup.getVersion();
  for (OmKeyLocationInfo omKeyLocationInfo : 
omKeyLocationInfoGroup.getLocationList()) {
    long containerId = omKeyLocationInfo.getContainerID();
    ...
  }
}
getLocationList() is documented as not O(1); it flatten-copies into a new List. 
handleKeyReprocess runs over the entire OM key table during Recon reprocess 
(ParallelTableIteratorOperation), so a list is allocated per version group per 
key across the whole keyspace.

Fix: iterate getLocationLists() (returns locationVersionMap.values() with no 
copy) with a nested loop. All sinks are container/version-keyed map operations, 
so element order is irrelevant. 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