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

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

> Avoid the throwaway list copy in OMAllocateBlockRequest quota check
> -------------------------------------------------------------------
>
>                 Key: HDDS-16211
>                 URL: https://issues.apache.org/jira/browse/HDDS-16211
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Huang Kuan Hao
>            Assignee: Huang Kuan Hao
>            Priority: Major
>              Labels: pull-request-available
>
> OMAllocateBlockRequest.validateAndUpdateCache computes the already-allocated 
> key size only to multiply by the block size, but calls getLocationList() 
> (documented as not O(1)) purely to read size(), then discards the list — on 
> every block allocation, under the bucket write lock:
> long hadAllocatedKeySize =
>     openKeyInfo.getLatestVersionLocations().getLocationList().size()
>         * ozoneManager.getScmBlockSize();
> Fix: use getLocationListCount() 
> (values().stream().mapToLong(List::size).sum()), which returns the same total 
> with no allocation. The result already widens to long for the multiplication, 
> so the value is unchanged. 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