Repository: mesos Updated Branches: refs/heads/master 5c8fc82e5 -> cdc60912f
Removed a few incorrect CHECKs in DRF sorter. Review: https://reviews.apache.org/r/35473 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/cdc60912 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/cdc60912 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/cdc60912 Branch: refs/heads/master Commit: cdc60912fa832d8a7ce5066226ff1ae3b9dc124a Parents: 5c8fc82 Author: Jie Yu <[email protected]> Authored: Mon Jun 15 14:14:22 2015 -0700 Committer: Jie Yu <[email protected]> Committed: Mon Jun 15 15:25:53 2015 -0700 ---------------------------------------------------------------------- src/master/allocator/sorter/drf/sorter.cpp | 33 ++++++++++++++----------- src/tests/examples_tests.cpp | 3 +-- 2 files changed, 19 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/cdc60912/src/master/allocator/sorter/drf/sorter.cpp ---------------------------------------------------------------------- diff --git a/src/master/allocator/sorter/drf/sorter.cpp b/src/master/allocator/sorter/drf/sorter.cpp index ac05afd..c5f4caf 100644 --- a/src/master/allocator/sorter/drf/sorter.cpp +++ b/src/master/allocator/sorter/drf/sorter.cpp @@ -174,33 +174,36 @@ void DRFSorter::unallocated( void DRFSorter::add(const SlaveID& slaveId, const Resources& _resources) { - resources[slaveId] += _resources; - - // We have to recalculate all shares when the total resources - // change, but we put it off until sort is called - // so that if something else changes before the next allocation - // we don't recalculate everything twice. - dirty = true; + if (!_resources.empty()) { + resources[slaveId] += _resources; + + // We have to recalculate all shares when the total resources + // change, but we put it off until sort is called so that if + // something else changes before the next allocation we don't + // recalculate everything twice. + dirty = true; + } } void DRFSorter::remove(const SlaveID& slaveId, const Resources& _resources) { - CHECK(resources.contains(slaveId)); + if (!_resources.empty()) { + CHECK(resources.contains(slaveId)); - resources[slaveId] -= _resources; - if (resources[slaveId].empty()) { - resources.erase(slaveId); - } + resources[slaveId] -= _resources; - dirty = true; + if (resources[slaveId].empty()) { + resources.erase(slaveId); + } + + dirty = true; + } } void DRFSorter::update(const SlaveID& slaveId, const Resources& _resources) { - CHECK(resources.contains(slaveId)); - resources[slaveId] = _resources; if (resources[slaveId].empty()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/cdc60912/src/tests/examples_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/examples_tests.cpp b/src/tests/examples_tests.cpp index 41a9265..2ff6e7a 100644 --- a/src/tests/examples_tests.cpp +++ b/src/tests/examples_tests.cpp @@ -32,8 +32,7 @@ TEST_SCRIPT(ExamplesTest, LowLevelSchedulerPthread, "low_level_scheduler_pthread_test.sh") -// TODO(bmahler): Temporary disabled until MESOS-2627 is fixed. -TEST_SCRIPT(DISABLED_ExamplesTest, PersistentVolumeFramework, +TEST_SCRIPT(ExamplesTest, PersistentVolumeFramework, "persistent_volume_framework_test.sh")
