> On Jan. 8, 2016, 10:36 a.m., Adam B wrote: > > Here's my first full pass over this patch. Couldn't find anything major > > except the PUT vs. POST question. > > I'll admit I was surprised to see in your testing section that `role1` > > showed up in `/roles` even though it has a default weight. Can you explain > > why that happens and if it was intended behavior?
I have updated the test result. The current behaviour is if weight is updated to the default weight (1.0) by /weights endpoint, then the non-default weights will not be showed up in /roles. > On Jan. 8, 2016, 10:36 a.m., Adam B wrote: > > src/master/master.cpp, line 1479 > > <https://reviews.apache.org/r/41681/diff/21/?file=1183536#file1183536line1479> > > > > Is `weights` loaded with the contents of `--weights` first? > > If there's a role in `--weights` that was since erased from the > > registry (weight=1.0), wouldn't `weights` still have the cmd-line value > > after fresh recovery? Yes, weights hashmap in master is loaded with --weights first before recovering the weights information from registry. And if registry.weights_size() > 0 when master recovery, then weights hashmap will be reloaded. After recovering from registry, then all cmd-value (specified by --weights) will be removed from weights hashmap. And If weight is updated to 1.0 by /weights, then it well be removed from registry and weights hashmap. > On Jan. 8, 2016, 10:36 a.m., Adam B wrote: > > src/master/master.cpp, lines 1471-1475 > > <https://reviews.apache.org/r/41681/diff/21/?file=1183536#file1183536line1471> > > > > Do you still want to update the allocator (push_back) with 1.0 weights? > > Are those even possible if we're recovering all this from the registry? > > Maybe we should just CHECK. weights hashmap and allocator are initialized by --weights flag before recovering from registry. In our design, we prefer to use weights information in registry and ignore the weights specified by --weights, so it needs to remove all non-default weight information (weights hashmap in allocator ) stored in allocator first, and then update the allocator with the weights recoverd from registry, if weight is updated to 1.0 then it will be removed from weights in allocator. - Yongqiao ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/41681/#review113439 ----------------------------------------------------------- On Jan. 8, 2016, 3 p.m., Yongqiao Wang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/41681/ > ----------------------------------------------------------- > > (Updated Jan. 8, 2016, 3 p.m.) > > > Review request for mesos, Adam B, Neil Conway, and Qian Zhang. > > > Bugs: MESOS-4214 > https://issues.apache.org/jira/browse/MESOS-4214 > > > Repository: mesos > > > Description > ------- > > Introduce HTTP endpoint /weights for updating weight. > > > Diffs > ----- > > include/mesos/authorizer/authorizer.hpp > 5ee3c7afadd131802c93febbb6b4dbad069c2d81 > include/mesos/authorizer/authorizer.proto > 84727e66dd14be9a25705ab1141e92eee72fae50 > src/CMakeLists.txt 6ae44c76def124bbd1ccd4e6ad510c2fd0bfda5e > src/Makefile.am bbd0c119321fa9d11fea61b140428dd92d1258c8 > src/authorizer/local/authorizer.hpp > 586f0da19c050e75e20902c376627c8f0b4bf272 > src/authorizer/local/authorizer.cpp > c1db9c2131ea8fbf835278203a240f108c6372c5 > src/master/http.cpp bcafc7aff89659a68352f3876ce6042f8b34bd5d > src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b > src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 > src/master/registry.proto 9958f9c2bdb785390fca2f292b65d5a9310434d5 > src/master/weights_handler.cpp PRE-CREATION > src/tests/mesos.hpp 3d9ebc6c9dc3cd1be02dc3771fbd847386907fac > src/tests/mesos.cpp 365ebe8335c37bfdb983a5424d4c995fa9b76a22 > > Diff: https://reviews.apache.org/r/41681/diff/ > > > Testing > ------- > > Make & Make check successfully! > > $ (./mesos-master.sh --ip=127.0.0.1 --work_dir=/Users/yqwyq/tmp/mesos-master > >> /tmp/mesos-master.log 2>&1 &) > $ curl -d > weights="[{\"weight\":1.0,\"role\":\"role1\"},{\"weight\":8.0,\"role\":\"role2\"}]" > -X PUT http://localhost:5050/weights > $ curl http://localhost:5050/roles > { > "roles": [ > { > "frameworks": [ ], > "name": "*", > "resources": { > "cpus": 0, > "disk": 0, > "mem": 0 > }, > "weight": 1 > }, > { > "frameworks": [ ], > "name": "role1", > "resources": { > "cpus": 0, > "disk": 0, > "mem": 0 > }, > "weight": 1 > }, > { > "frameworks": [ ], > "name": "role2", > "resources": { > "cpus": 0, > "disk": 0, > "mem": 0 > }, > "weight": 8 > } > ] > } > > > Thanks, > > Yongqiao Wang > >
