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 54836: Added helpers to allocate / unallocate Resources.
Date Sun, 18 Dec 2016 16:35:19 GMT


> On Dec. 18, 2016, 1:10 a.m., Guangya Liu wrote:
> > src/common/resources.cpp, line 1075
> > <https://reviews.apache.org/r/54836/diff/1/?file=1588580#file1588580line1075>
> >
> >     How about put this in the `if` block?

Then this wouldn't clear the allocation?


> On Dec. 18, 2016, 1:10 a.m., Guangya Liu wrote:
> > include/mesos/resources.hpp, line 339
> > <https://reviews.apache.org/r/54836/diff/1/?file=1588578#file1588578line339>
> >
> >     What is the use of the return value here, can you please add more comments here
for its usage? I think that the `unallocate()` will be called by `recoverResources`, and what
is the problem if `unalocate` just return void for such case?

It can return void, which would provide similar semantics to the `Clear()` family of functions
in the protobuf api.

I opted instead to return the additional information about whether any changes were needed,
so that the caller could do something like:

```
// We don't expect the resources to be already unallocated!
CHECK(resources.unallocate());
```

Like map::erase, or map::insert provides information about this for callers to check (rather
than needing an additional explicit check). I clarified the wording here a bit.


> On Dec. 18, 2016, 1:10 a.m., Guangya Liu wrote:
> > src/common/resources.cpp, line 1062
> > <https://reviews.apache.org/r/54836/diff/1/?file=1588580#file1588580line1062>
> >
> >     Shall we add a `CHECK` here to make sure this resource was not allocated to
any role?

We could, the alternative that I went for was to have callers (the allocator) CHECK this invariant
if they care about it, since it seems specific to the way the allocator works.


- Benjamin


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


On Dec. 17, 2016, 10:50 p.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/54836/
> -----------------------------------------------------------
> 
> (Updated Dec. 17, 2016, 10:50 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Jay Guo, and Guangya Liu.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added helpers to allocate / unallocate Resources.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp c2e6d6680d9687f0bbfb73e84ffb1457072c4412 
>   include/mesos/v1/resources.hpp 98f025b68c818c384a1174ef9b969f5c0776a7f1 
>   src/common/resources.cpp 16f6de6741b548a8a9fff5b70447b1a312f10efe 
>   src/tests/resources_tests.cpp c0ff9777ceb1731086179e2966b07c46d035c110 
>   src/v1/resources.cpp a1adf1b27964bf6a89d97715cff05878d8c6cae9 
> 
> Diff: https://reviews.apache.org/r/54836/diff/
> 
> 
> Testing
> -------
> 
> Updated the existing allocation test to incorporate the new helper.
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>


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