Shilun Fan created HDDS-15275:
---------------------------------

             Summary: DiskBalancer getIdealUsage handles zero capacity 
incorrectly
                 Key: HDDS-15275
                 URL: https://issues.apache.org/jira/browse/HDDS-15275
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Shilun Fan
            Assignee: Shilun Fan


DiskBalancerVolumeCalculation#getIdealUsage does not explicitly handle empty 
volume lists or volume snapshots whose total capacity is zero.

Current implementation sums the total capacity and effective used bytes, then 
directly divides:
{code:java}
return ((double) totalEffectiveUsed) / totalCapacity; {code}
If the input volume list is empty, totalCapacity is 0, so the method returns 
NaN. If all volumes have zero capacity, the method may return NaN or Infinity 
depending on effective used bytes.

This is inconsistent with the method Javadoc, which says an 
IllegalArgumentException is thrown when total capacity is zero.



--
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