mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Wu <jos...@mesosphere.io>
Subject Re: Review Request 48593: Refactor Ranges Subtraction.
Date Fri, 08 Jul 2016 22:05:45 GMT

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




src/common/values.cpp (line 271)
<https://reviews.apache.org/r/48593/#comment206870>

    Make sure you use the `uint64_t` type.  
    
    Here and below; and in tests.



src/common/values.cpp (lines 275 - 278)
<https://reviews.apache.org/r/48593/#comment206864>

    There's no need to use an integer iterator here.  Do this instead:
    
    ```
    foreach (const Value::Range& range, ranges.range()) {
      set += (Bound<int>::closed(range.begin()),
              Bound<int>::closed(range.end()));
    }
    ```



src/common/values.cpp (line 287)
<https://reviews.apache.org/r/48593/#comment206865>

    No need for this.  See below comment.



src/common/values.cpp (line 288)
<https://reviews.apache.org/r/48593/#comment206867>

    Can you rename this local variable to `ranges`?



src/common/values.cpp (lines 292 - 295)
<https://reviews.apache.org/r/48593/#comment206866>

    When you add an item to a protobuf array, the generated C++ code returns a pointer than
you can further modify:
    
    ```
    Value::Range* range = ranges.add_range();
    range->set_begin(s.lower());
    range->set_end(s.upper() - 1);
    ```



src/common/values.cpp (line 400)
<https://reviews.apache.org/r/48593/#comment206869>

    Consider renaming to `leftSet` and `rightSet`.



src/common/values.cpp (line 402)
<https://reviews.apache.org/r/48593/#comment206862>

    We should be able to forgo this `coalesce` step now.  
    
    Before, this would normalize the input, by sorting the ranges and merging adjacent ranges.
 Converting to `IntervalSet` should take care of this for us.



src/common/values.cpp (lines 405 - 406)
<https://reviews.apache.org/r/48593/#comment206868>

    You could inline these two.



src/tests/values_tests.cpp (line 339)
<https://reviews.apache.org/r/48593/#comment206871>

    Missing a comma after the second interval.



src/tests/values_tests.cpp (lines 362 - 364)
<https://reviews.apache.org/r/48593/#comment206872>

    Here, you have (closed, open) bounds.
    
    In the implementation, you (correctly) use (closed, closed) bounds.  Consider normalizing.


- Joseph Wu


On July 7, 2016, 6:42 p.m., Yanyan Hu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/48593/
> -----------------------------------------------------------
> 
> (Updated July 7, 2016, 6:42 p.m.)
> 
> 
> Review request for mesos, Alexander Rukletsov, Guangya Liu, and Joris Van Remoortere.
> 
> 
> Bugs: MESOS-5425
>     https://issues.apache.org/jira/browse/MESOS-5425
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This patch reimplement Ranges subtraction using
> IntervalSet data type: Ranges values will be
> converted to IntervalSet values for subtraction
> and the result will be converted back to Ranges
> after subtraction is done. This change is for
> fixing jira MESOS-5425.
> 
> 
> Diffs
> -----
> 
>   src/common/values.cpp 587cb68551d438621e215953e89818b623b7f71b 
>   src/tests/values_tests.cpp 929861549e3155c33966896f817f9bf9e6d14354 
> 
> Diff: https://reviews.apache.org/r/48593/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Yanyan Hu
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message