You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/08/24 14:33:00 UTC

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

     [ https://issues.apache.org/jira/browse/HDDS-16216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated HDDS-16216:
----------------------------------
    Labels: pull-request-available  (was: )

> 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: Chenchen Lai
>            Priority: Major
>              Labels: pull-request-available
>
> 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