> On May 24, 2018, 12:39 a.m., Jie Yu wrote: > > src/common/validation.hpp > > Lines 57 (patched) > > <https://reviews.apache.org/r/67274/diff/1/?file=2027775#file2027775line57> > > > > I wonder if we should just chagne `Resources::validate` given that we > > already check if resource.scalar is not negative in the method.
I initially put a check for non-zeroness into `Resources::validate`, but we do depend on being able to e.g., parse zero resource scalar amounts. As an example, agent default resources of the form `cpus:1;mem:32;disk:32;gpus:3` should remain allowed as they might be generated automatically; a similar argument could be made for resources explicitly specified as exactly zero in offer operations. I relaxed the check to only reject non-zero resource values which would be rounded to zero and put it into `Resources::validate` instead. - Benjamin ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/67274/#review203707 ----------------------------------------------------------- On May 24, 2018, 11:09 a.m., Benjamin Bannier wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/67274/ > ----------------------------------------------------------- > > (Updated May 24, 2018, 11:09 a.m.) > > > Review request for mesos, Jie Yu, Joris Van Remoortere, Michael Park, and > Neil Conway. > > > Bugs: MESOS-8945 > https://issues.apache.org/jira/browse/MESOS-8945 > > > Repository: mesos > > > Description > ------- > > Internally values of scalar resources are stored in a fixed point > representation. This can lead to (expected) precision loss. > > This patch adds resource validation ensuring that values of scalar > resources are either zero or large enough so that they are still > represented as non-zero values after conversion to the internal fixed > point format. > > While this patch should not change valid, intended use cases, it might > change the behavior for erroneous, already broken framework workflows. > > > Diffs > ----- > > src/common/resources.cpp 192d086e60b81c0ae8e26d4120beee2034f63d3e > src/tests/master_tests.cpp 6a0fa988aebaf1cf66abaaca0c628f981c6ccc31 > src/tests/resources_tests.cpp 1201efec3ff0abc268f896c1fe2330571390b3fd > > > Diff: https://reviews.apache.org/r/67274/diff/2/ > > > Testing > ------- > > `make check` > > > Thanks, > > Benjamin Bannier > >
