-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/70472/#review214769
-----------------------------------------------------------



Much simpler! Left a few suggestions below


src/master/validation.hpp
Lines 144 (patched)
<https://reviews.apache.org/r/70472/#comment301024>

    Why the copying? Can you take this by const ref?



src/master/validation.cpp
Lines 908 (patched)
<https://reviews.apache.org/r/70472/#comment301026>

    Maybe a brief explanation? E.g.
    
    ```
    If the sum of quantities of each Resources is not equal to the quantity of 
the sum of Resources, then there is some overlap in ranges or sets.
    ```



src/master/validation.cpp
Lines 909 (patched)
<https://reviews.apache.org/r/70472/#comment301025>

    newline?
    
    Also maybe this is more readable?
    
    ```
    if (!resources.empty()) {
    
    }
    ```
    
    Actually, why bother with if check? The code looks correct and more 
readable without it?



src/master/validation.cpp
Lines 910-918 (patched)
<https://reviews.apache.org/r/70472/#comment301027>

    Might be more readable with two running sums in one loop rather than the 
use of accumulate (which seems a bit inconcistent? either use accumulate for 
both or loop for both?)
    
    If you keep two running sums, can't we print out where the overlap is?
    
    ```
      ResourceQuantities qTotal;
      Resources rTotal;
      
      foreach (const Resources& r, resources) {
        qTotal += ResourceQuantities::fromResources(r);
        rTotal += r;
      }
      
      if (qTotal != ResourceQuantities::fromResources(rTotal)) {
        ...
      }
    ```



src/master/validation.cpp
Lines 917 (patched)
<https://reviews.apache.org/r/70472/#comment301028>

    Hm.. I guess we don't know where the overlap is, but seems we should have 
some printing somewhere.. a good start would be to output the vector, but it 
won't let us know which parts came from tasks/executor.
    
    Maybe the outer message below can include it?
    
    ```
        return Error("There are overlapping resources in the tasks resources" +
                     vector of task resources +
                     " and/or executor resources " +
                     executor resources);
    ```



src/master/validation.cpp
Lines 1673 (patched)
<https://reviews.apache.org/r/70472/#comment301029>

    See my above comment, maybe we don't need to tack on the message here since 
it isn't helpful, and maybe we can just have that function return a bool?


- Benjamin Mahler


On April 19, 2019, 7:57 a.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/70472/
> -----------------------------------------------------------
> 
> (Updated April 19, 2019, 7:57 a.m.)
> 
> 
> Review request for mesos, Benno Evers, Benjamin Mahler, Gastón Kleiman, and 
> Meng Zhu.
> 
> 
> Bugs: MESOS-9619
>     https://issues.apache.org/jira/browse/MESOS-9619
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This patch adds validation to the master to ensure that task
> groups do not include resources with overlapping set- or
> range-valued resources, as this can crash the allocator.
> 
> 
> Diffs
> -----
> 
>   src/master/validation.hpp 71748c121aa3518d68811ea1e60707d195b58657 
>   src/master/validation.cpp f032a781608857d0c9cfa220dd8d70f74d60f1ec 
>   src/tests/master_tests.cpp 964d935771a99efaee63187affe46b551146f310 
>   src/tests/master_validation_tests.cpp 
> 400ad686291e08f578f27cfb9341263972e36684 
> 
> 
> Diff: https://reviews.apache.org/r/70472/diff/2/
> 
> 
> Testing
> -------
> 
> `make check`
> `bin/mesos-tests.sh --gtest_filter="*NonoverlappingSetsAndRanges*" 
> --gtest_repeat=-1 --gtest_break_on_failure`
> `bin/mesos-tests.sh 
> --gtest_filter="*LaunchGroupOverlappingSetAndRangeResources*" 
> --gtest_repeat=-1 --gtest_break_on_failure`
> 
> 
> Thanks,
> 
> Greg Mann
> 
>

Reply via email to