GitHub user srdo opened a pull request:

    https://github.com/apache/storm/pull/2485

    STORM-2859: Fix a number of issues with NormalizedResources when reso…

    …urce totals are zero
    
    Issues fixed:
    * calculateMinPercentageUsedBy threw division by 0 error if total cpu or 
memory was 0.
    * remove was quietly skipping any resources that was present in only one 
resource list. I think we should make sure to cover all resources in the input 
list, so add/remove behave like normal vector addition. 
    * Added check that all resources in a rack/node are also present in the 
total when doing calculateAvg and calculateMin.
    * calculateAvg was being inconsistent about the divisor in the average 
between cpu/memory and other resources. Fixed so resources that are not 
accounted for in the total are also not counted in the divisor. 
    * calculateMin didn't handle resource totals being 0 very well. The method 
defined `a/0 = 0`, so if any resource in the total had a 0 value, the method 
would return 0 and all racks/nodes would end up being prioritized equally. 
Changed calculateMin and calculateAvg to skip any resources where the total of 
that resource is 0. I think it makes sense to disregard such resources and fall 
back on prioritizing by any remaining non-0 resources. calculateAvg actually 
already did this for cpu and memory. In case there are no non-0 resources in 
the total, we can just return 100% for both average and minimum to disable 
prioritization, since any rack/node is as good as any other.
    * Fixed up NormalizedResources constructor so it doesn't call an 
overridable method.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/srdo/storm STORM-2859

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/storm/pull/2485.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2485
    
----
commit 8f2a66d23e382d22fdc6a4ee32a53b442f2e153a
Author: Stig Rohde Døssing <srdo@...>
Date:   2017-12-13T15:47:31Z

    STORM-2859: Fix a number of issues with NormalizedResources when resource 
totals are zero

----


---

Reply via email to