[
https://issues.apache.org/jira/browse/HDDS-12657?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Siddhant Sangwan closed HDDS-12657.
-----------------------------------
> Change logic for checking whether a volume has enough space
> -----------------------------------------------------------
>
> Key: HDDS-12657
> URL: https://issues.apache.org/jira/browse/HDDS-12657
> Project: Apache Ozone
> Issue Type: Sub-task
> Components: Ozone Datanode, SCM
> Reporter: Siddhant Sangwan
> Priority: Major
>
> This logic is used in several places to check whether a volume has enough
> space.
> {code}
> public static boolean hasVolumeEnoughSpace(long volumeAvailableSpace,
> long volumeCommittedBytesCount,
> long requiredSpace,
> long volumeFreeSpaceToSpare) {
> return (volumeAvailableSpace - volumeCommittedBytesCount) >
> Math.max(requiredSpace, volumeFreeSpaceToSpare);
> }
> {code}
> It should be changed to
> {code}
> return (volumeAvailableSpace - volumeCommittedBytesCount -
> volumeFreeSpaceToSpare) > requiredSpace;
> {code}
> Why?
> Take for example that volumeAvailableSpace - volumeCommittedBytesCount is
> 6GB. requiredSpace is 5GB and volumeFreeSpaceToSpare is also 5GB. The current
> logic will return true, implying that it is ok to fill up 5GB out of that 6GB
> such that only 1GB remains.
> With the suggested logic, the method will return false. Of course, that 6GB
> space can still get filled up because of parallel writes to this volume and
> because we don't have a hard stop on writes when they cross min free space
> boundary, but this change should still improve things.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]