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

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


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

commit ab01f5a5bf905365da17497e4db4ff15832e6dee
Author: Meng Zhu <m...@mesosphere.io>
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/sorter/drf/sorter.hpp    | 6 ++++--
 src/master/allocator/sorter/random/sorter.hpp | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/master/allocator/sorter/drf/sorter.hpp 
b/src/master/allocator/sorter/drf/sorter.hpp
index 91a9d66..7daf1bf 100644
--- a/src/master/allocator/sorter/drf/sorter.hpp
+++ b/src/master/allocator/sorter/drf/sorter.hpp
@@ -337,7 +337,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;
@@ -375,7 +376,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/sorter/random/sorter.hpp 
b/src/master/allocator/sorter/random/sorter.hpp
index 55e22d7..c8e777b 100644
--- a/src/master/allocator/sorter/random/sorter.hpp
+++ b/src/master/allocator/sorter/random/sorter.hpp
@@ -357,7 +357,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;
@@ -395,7 +396,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