mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Mahler <bmah...@apache.org>
Subject Re: Review Request 69819: Added equality operator for `ResourceQuantities`.
Date Mon, 28 Jan 2019 19:49:17 GMT

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



When we added `ResourceQuantities`, we wanted to support two use cases:

```
guarantees: absent == 0    (i.e. zero_by_default)
    limits: absent == +inf (i.e. inf_by_default)
```

This is why zeros are currently stored (unlike `Resources` objects, where they are removed):
having the ability to distinguish between 0 and absent allows us to support both use cases.
However, the introduction of equality and containment operations are not so obvious:

```
   equality: the approach in this patch is providing inf_by_default equality semantics AFAICT
containment: the approach in the subsequent patch is providing neither zero_by_default or
inf_by_default equality semantics
```

I think that in order to introduce equality and containment, we may have to address some earlier
feedback on `ResourceQuantities`, which was to require a contruction-time choice between `ZERO_BY_DEFAULT`
and `INF_BY_DEFAULT` semantics. This would be stored as a variable in order to determine (1)
whether to store zeros, (2) how to evaluate equality and containment between two quantities.

Thoughts?

- Benjamin Mahler


On Jan. 23, 2019, 12:12 p.m., Benjamin Bannier wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/69819/
> -----------------------------------------------------------
> 
> (Updated Jan. 23, 2019, 12:12 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Meng Zhu.
> 
> 
> Bugs: MESOS-9523
>     https://issues.apache.org/jira/browse/MESOS-9523
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This patch adds an `operator==` for `ResourceQuantities`. The operator
> is declared as a `friend` of `ResourceQuantities` so we can directly
> compare the two `ResourceQuantities::quantities` which can be less
> expensive.
> 
> 
> Diffs
> -----
> 
>   src/common/resource_quantities.hpp 11eb426104577bbbbb7977c2307df3e4917085cd 
>   src/common/resource_quantities.cpp 320983929cd7d14973c4b98d6ed5338de690ff5f 
> 
> 
> Diff: https://reviews.apache.org/r/69819/diff/1/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Benjamin Bannier
> 
>


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