----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/64793/#review194386 -----------------------------------------------------------
s/This may starve roles behind it that have quotas set for those resources./This may violate the guarantees of that other roles have set on these resources/ ? src/master/allocator/mesos/hierarchical.cpp Lines 1848-1890 (patched) <https://reviews.apache.org/r/64793/#comment273154> Perhaps something like shrink? ``` // Returns true if we shrunk the resource to the target size, // or the resource is already within the target size. Returns // false otherwise (i.e. the resource is indivisible. E.g. // MOUNT volume). bool shrink = [](Resource* r, const Value::Scalar& target) { if (r->scalar() <= target) { return true; // Already within target. } Resource copy = *r; copy.mutable_scalar()->CopyFrom(target); if (Resources(*r).contains(copy)) { r->CopyFrom(copy); return true; } return false; }; ``` We could put this in the resources library. src/master/allocator/mesos/hierarchical.cpp Lines 1905-1917 (patched) <https://reviews.apache.org/r/64793/#comment273143> Perhaps this needs to be merged into the overall comment above? Seems like we just need to update the above comment to reflect the additional headroom check? src/master/allocator/mesos/hierarchical.cpp Lines 1893-1895 (original), 1952-1955 (patched) <https://reviews.apache.org/r/64793/#comment273153> Perhaps a formula here would be helpful? ``` // Compute the amount of resources that can be allocated // without violating quota headroom: // // Allocation Limit = (Available Headroom - Required Headroom) - // Tentative Allocation to Role ``` Something like this? src/master/allocator/mesos/hierarchical.cpp Lines 1894-1895 (original), 1953-1955 (patched) <https://reviews.apache.org/r/64793/#comment273149> I couldn't quite follow this formula, why do we need to subtract the last two? src/master/allocator/mesos/hierarchical.cpp Lines 1928-1929 (original), 1976-1978 (patched) <https://reviews.apache.org/r/64793/#comment273150> A little indirect but "progress towards quota" means that the resources are non empty, right? Maybe we want to explicitly mention that? - Benjamin Mahler On Dec. 22, 2017, 12:48 a.m., Meng Zhu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/64793/ > ----------------------------------------------------------- > > (Updated Dec. 22, 2017, 12:48 a.m.) > > > Review request for mesos and Benjamin Mahler. > > > Bugs: MESOS-8352 > https://issues.apache.org/jira/browse/MESOS-8352 > > > Repository: mesos > > > Description > ------- > > In the quota role allocation stage, if a role gets some resources > on an agent to meet its quota, it will also get all other resources > on the same agent that it does not have quota for. This may starve > roles behind it that have quotas set for those resources. > > We fix this issue by enforcing that, in the quota role allocation > stage, if a role has no quota set for a scalar resource, it will > get that resource only when two conditions are both met: > > (1) It got some other resources on the same agent to meet its quota; > > (2) After allocating those resources, quota headroom is still above > the required amount. > > Also refactored the fine-grained quota allocation logic. > > > Diffs > ----- > > src/master/allocator/mesos/hierarchical.cpp > 7f7dae1950bebd22191189c2db0f6678d2e8fa3c > > > Diff: https://reviews.apache.org/r/64793/diff/1/ > > > Testing > ------- > > make check > > > Thanks, > > Meng Zhu > >
