This is an automated email from the ASF dual-hosted git repository.

mzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 3457771  Made `CHECK` in sorter print out more info upon failure.
3457771 is described below

commit 3457771b42993c85e3da3c4550b233f61b14bc99
Author: Meng Zhu <[email protected]>
AuthorDate: Fri Oct 4 10:48:40 2019 -0400

    Made `CHECK` in sorter print out more info upon failure.
    
    Review: https://reviews.apache.org/r/71581
---
 src/master/allocator/mesos/sorter/drf/sorter.hpp    | 6 ++++--
 src/master/allocator/mesos/sorter/random/sorter.hpp | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/master/allocator/mesos/sorter/drf/sorter.hpp 
b/src/master/allocator/mesos/sorter/drf/sorter.hpp
index ab20a86..3f6c741 100644
--- a/src/master/allocator/mesos/sorter/drf/sorter.hpp
+++ b/src/master/allocator/mesos/sorter/drf/sorter.hpp
@@ -333,7 +333,8 @@ struct DRFSorter::Node
 
     void subtract(const SlaveID& slaveId, const Resources& toRemove)
     {
-      CHECK(resources.contains(slaveId));
+      CHECK(resources.contains(slaveId))
+        << "Resources " << resources << " does not contain " << slaveId;
       CHECK(resources.at(slaveId).contains(toRemove))
         << "Resources " << resources.at(slaveId) << " at agent " << slaveId
         << " does not contain " << toRemove;
@@ -371,7 +372,8 @@ struct DRFSorter::Node
       const ResourceQuantities newAllocationQuantities =
         ResourceQuantities::fromScalarResources(newAllocation.scalars());
 
-      CHECK(resources.contains(slaveId));
+      CHECK(resources.contains(slaveId))
+        << "Resources " << resources << " does not contain " << slaveId;
       CHECK(resources[slaveId].contains(oldAllocation))
         << "Resources " << resources[slaveId] << " at agent " << slaveId
         << " does not contain " << oldAllocation;
diff --git a/src/master/allocator/mesos/sorter/random/sorter.hpp 
b/src/master/allocator/mesos/sorter/random/sorter.hpp
index 06362ce..a3097be 100644
--- a/src/master/allocator/mesos/sorter/random/sorter.hpp
+++ b/src/master/allocator/mesos/sorter/random/sorter.hpp
@@ -353,7 +353,8 @@ struct RandomSorter::Node
 
     void subtract(const SlaveID& slaveId, const Resources& toRemove)
     {
-      CHECK(resources.contains(slaveId));
+      CHECK(resources.contains(slaveId))
+        << "Resources " << resources << " does not contain " << slaveId;
       CHECK(resources.at(slaveId).contains(toRemove))
         << "Resources " << resources.at(slaveId) << " at agent " << slaveId
         << " does not contain " << toRemove;
@@ -391,7 +392,8 @@ struct RandomSorter::Node
       const ResourceQuantities newAllocationQuantities =
         ResourceQuantities::fromScalarResources(newAllocation.scalars());
 
-      CHECK(resources.contains(slaveId));
+      CHECK(resources.contains(slaveId))
+        << "Resources " << resources << " does not contain " << slaveId;
       CHECK(resources[slaveId].contains(oldAllocation))
         << "Resources " << resources[slaveId] << " at agent " << slaveId
         << " does not contain " << oldAllocation;

Reply via email to