> On March 22, 2017, 9:13 a.m., Qian Zhang wrote: > > src/master/quota_handler.cpp > > Lines 160 (patched) > > <https://reviews.apache.org/r/57167/diff/6/?file=1666651#file1666651line160> > > > > Maybe we need to add the following code at the beginning for the leaf > > node? > > ``` > > if (children.empty()) { > > return None(); > > } > > ```
The current code should be correct for leaf nodes as well -- i.e., `childResources` will be empty, so `selfResources.contains(childResources)` will always be true. I'd prefer not to add an explicit and redundant check for `children.empty()` unless it is necessary for correctness. > On March 22, 2017, 9:13 a.m., Qian Zhang wrote: > > src/master/quota_handler.cpp > > Lines 173 (patched) > > <https://reviews.apache.org/r/57167/diff/6/?file=1666651#file1666651line173> > > > > What if this is a node created implicitly and has no quota? Or actually > > we do not support setting quota for `a/b` before setting quota for `a`? Right -- we don't support setting quota on `a/b` before setting quota on `a`. (Note that when building a quota tree from a set of quotas, we might see the quota for `a/b` before we see the quota for `a`; in that case, the quota tree will be invalid until the quota for `a` is seen. But once all quotas are seen the quota tree should be valid.) - Neil ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/57167/#review169676 ----------------------------------------------------------- On March 17, 2017, 2:10 a.m., Neil Conway wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/57167/ > ----------------------------------------------------------- > > (Updated March 17, 2017, 2:10 a.m.) > > > Review request for mesos and Michael Park. > > > Repository: mesos > > > Description > ------- > > The quota'd resources for a nested role are "included" within the > quota'd resources for that role's parent. Hence, the quota of a node > must always be greater than or equal to the sum of the quota'd resources > of that role's children. > > When creating and removing quota, we must ensure that this invariant is > not violated. > > When computing the cluster capacity heuristic, we must ensure that we do > not "double-count" quota'd resources: e.g., if the cluster has a total > capacity of 100 CPUs, role "x" has a quota guarantee of 80 CPUs, and > role "x/y" has a quota guarantee of 40 CPUs, this does NOT violate the > cluster capacity heuristic. > > > Diffs > ----- > > src/master/quota_handler.cpp 36ea1acca47014b2fb7a3b597b857c8ec9e2ab67 > src/tests/hierarchical_allocator_tests.cpp > e343dc37bd7136f0f6dd5dbc22a25cabe715038d > src/tests/master_quota_tests.cpp e418f22ea1773f4356ced44b8d57a80e826c8837 > > > Diff: https://reviews.apache.org/r/57167/diff/6/ > > > Testing > ------- > > `make check` > > > Thanks, > > Neil Conway > >