Zhu Zhu created FLINK-14974:
-------------------------------

             Summary: Managed memory fractions should be rounded properly to 
not summed up to be more than 1.0
                 Key: FLINK-14974
                 URL: https://issues.apache.org/jira/browse/FLINK-14974
             Project: Flink
          Issue Type: Sub-task
          Components: Runtime / Coordination
    Affects Versions: 1.10.0
            Reporter: Zhu Zhu
             Fix For: 1.10.0


Managed memory fractions should be rounded to floor at a certain precision when 
divided by the number of operators, otherwise the fractions can be summed up to 
be more than 1.0 due to the double precision issue, and the last operator may 
fail to allocate managed memory it is supposed to be able to acquire.

To achieve that, I think we should change 
{{StreamingJobGraphGenerator#setManagedMemoryFractionForOperator}} to use 
BigDecimal#divide(otherValue, scale, RoundMode.ROUND_DOWN) to calculate the 
fractions. In this way, the sum of the fractions will not exceed 1.0.
The scale can be a bit larger (maybe 16) so that we only lose little managed 
memory.

cc [~chesnay]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to