> On July 29, 2016, 1:14 a.m., Jiang Yan Xu wrote: > > src/common/resources.cpp, lines 848-850 > > <https://reviews.apache.org/r/45959/diff/9/?file=1448695#file1448695line848> > > > > Just trying to see if the comments can be made more concise: > > > > ``` > > Assuming the wrapped Resource objects are equal, the 'contains' > > relationship is determined by the relationship of the counters for shared > > resources. > > ```
It did not make the comments much more concise but I updated the comments though. > On July 29, 2016, 1:14 a.m., Jiang Yan Xu wrote: > > src/common/resources.cpp, line 856 > > <https://reviews.apache.org/r/45959/diff/9/?file=1448695#file1448695line856> > > > > Here an `else` clause is more explicit. > > > > ``` > > else { > > return internal::contains(resource, that.resource); > > } > > ``` I think both are equivalent. > On July 29, 2016, 1:14 a.m., Jiang Yan Xu wrote: > > src/common/resources.cpp, lines 255-279 > > <https://reviews.apache.org/r/45959/diff/9/?file=1448695#file1448695line255> > > > > Why the change from the last revision? > > > > Sharedness check at the top allows us to short-circuit the checking for > > shared resources and allow us to not have to consider shared resources as a > > possbility in subsequent if conditions which is better IMO both for > > simplicity and performance (even if the difference in performance may not > > be significant). Whoops. This was based on a comment from Klaus Ma, but the earlier implementation addressed that since `bool operator==(const Resource& left, const Resource& right)` has all the checks. I misread the `operator==()` to only check for values. I will revert this to original version. > On July 29, 2016, 1:14 a.m., Jiang Yan Xu wrote: > > src/common/resources.cpp, lines 323-346 > > <https://reviews.apache.org/r/45959/diff/9/?file=1448695#file1448695line323> > > > > Ditto. Reverted to earlier version. - Anindya ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/45959/#review143997 ----------------------------------------------------------- On July 28, 2016, 10:42 p.m., Anindya Sinha wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/45959/ > ----------------------------------------------------------- > > (Updated July 28, 2016, 10:42 p.m.) > > > Review request for mesos, Benjamin Mahler, Joris Van Remoortere, and Jiang > Yan Xu. > > > Bugs: MESOS-4892 > https://issues.apache.org/jira/browse/MESOS-4892 > > > Repository: mesos > > > Description > ------- > > A new class Resource_ is added that allows 'Resources' to group > identical shared resource objects together into a single 'Resource_' > object and tracked by its shared count. Non-shared resource objects > are not grouped. > > For resource addition and subtraction, the shared count is adjusted for > shared resources as follows: > a) Addition: If shared resource is absent from original, then the > resource is added initialized with a consumer count of 1. Otherwise, > the share count for the shared resource is incremented. > b) Subtraction: If shared resource's share count is already 1, then > the shared resource is removed from the original. Otherwise, its > consumer count is decremented. > > Note that v1 changes for shared resources are in the next commit. > > > Diffs > ----- > > include/mesos/resources.hpp 88a9feabf66ed34e7e5b1c6cb7e831818e7f7883 > src/common/resources.cpp 3dbff24d6859d3b1ed8589cec50170a5202cfbcb > src/master/validation.cpp 52002beac29c371411348cb026a216e99ac96ab2 > src/tests/mesos.hpp 51c66f175c80ebacd5af230222ea7e4c81dfc1e8 > src/tests/resources_tests.cpp 4111e080b84079e100b731c9a56861b204f17388 > > Diff: https://reviews.apache.org/r/45959/diff/ > > > Testing > ------- > > New tests added to demonstrate arithmetic operations for shared resources > with consumer counts. > Tests successful. > > > Thanks, > > Anindya Sinha > >
