You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Huang Kuan Hao (Jira)" <ji...@apache.org> on 2026/08/18 07:47:00 UTC

[jira] [Created] (HDDS-16216) Avoid the flatten-copy in KeyInputStream.getBlockLocationInfo

Huang Kuan Hao created HDDS-16216:
-------------------------------------

             Summary: Avoid the flatten-copy in KeyInputStream.getBlockLocationInfo
                 Key: HDDS-16216
                 URL: https://issues.apache.org/jira/browse/HDDS-16216
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Huang Kuan Hao
            Assignee: Huang Kuan Hao


getBlockLocationInfo allocates a flattened list on the per-block read / pipeline-refresh path just to find one block by ID:

List<OmKeyLocationInfo> collect =
    newKeyInfo.getLatestVersionLocations()
        .getLocationList()
        .stream()
        .filter(l -> l.getBlockID().equals(blockID))
        .collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
  return collect.get(0);
} else {
  return null;
}
Fix: iterate getLocationLists() and return on the first blockID match (short-circuits, no copy). Do not use getBlocksLatestVersionOnly() — the block may live in a non-latest createVersion bucket, so narrowing the search would change behavior. Behavior unchanged.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org