This is an automated email from the ASF dual-hosted git repository.
jpeach 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 0fbc5ae Improve master CHECK messages.
0fbc5ae is described below
commit 0fbc5ae394bf3dbc878f934c24a9790c0e257840
Author: James Peach <[email protected]>
AuthorDate: Thu Jun 20 21:01:09 2019 -0700
Improve master CHECK messages.
For master CHECKs that fail by looking up some unique key, log
the key to aid debugging.
Review: https://reviews.apache.org/r/70881/
---
src/master/master.cpp | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 8a238aa..d15b2d9 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -4343,7 +4343,7 @@ void Master::accept(
CHECK_SOME(slaveId);
Slave* slave = slaves.registered.get(slaveId.get());
- CHECK_NOTNULL(slave);
+ CHECK(slave != nullptr) << slaveId.get();
// Validate and upgrade all of the resources in `accept.operations`:
//
@@ -8499,7 +8499,8 @@ void Master::updateSlave(UpdateSlaveMessage&& message)
oldOperation->latest_status().state()) &&
protobuf::isTerminalState(
newOperation->latest_status().state())) {
- Operation* operation = CHECK_NOTNULL(slave->getOperation(uuid));
+ Operation* operation = slave->getOperation(uuid);
+ CHECK(operation != nullptr) << uuid;
UpdateOperationStatusMessage update =
protobuf::createUpdateOperationStatusMessage(
@@ -9876,7 +9877,9 @@ void Master::reconcileOperations(
// capability, then we forward the reconciliation request to the
agent
// to respond based on whether or not this resource provider has been
// seen before. Otherwise, we respond with OPERATION_UNKNOWN.
- Slave* slave = CHECK_NOTNULL(slaves.registered.get(slaveId.get()));
+ Slave* slave = slaves.registered.get(slaveId.get());
+ CHECK(slave != nullptr) << slaveId.get();
+
if (resourceProviderId.isSome() &&
!slave->resourceProviders.contains(resourceProviderId.get()) &&
slave->capabilities.agentOperationFeedback) {
@@ -11099,7 +11102,7 @@ void Master::removeFramework(Framework* framework)
<< "External resource provider is not supported yet";
Slave* slave = slaves.registered.get(operation->slave_id());
- CHECK_NOTNULL(slave);
+ CHECK(slave != nullptr) << operation->slave_id();
slave->markOperationAsOrphan(operation);
@@ -11826,7 +11829,7 @@ void Master::updateTask(Task* task, const StatusUpdate&
update)
// The slave owns the Task object and cannot be nullptr.
Slave* slave = slaves.registered.get(task->slave_id());
- CHECK_NOTNULL(slave);
+ CHECK(slave != nullptr) << task->slave_id();
slave->recoverResources(task);
@@ -11873,7 +11876,7 @@ void Master::removeTask(Task* task, bool unreachable)
// The slave owns the Task object and cannot be nullptr.
Slave* slave = slaves.registered.get(task->slave_id());
- CHECK_NOTNULL(slave);
+ CHECK(slave != nullptr) << task->slave_id();
// Note that we explicitly convert from protobuf to `Resources` here
// and then use the result below to avoid performance penalty for multiple
@@ -12069,7 +12072,7 @@ void Master::updateOperation(
// TODO(jieyu): Revisit this once we introduce support for external
// resource provider.
Slave* slave = slaves.registered.get(operation->slave_id());
- CHECK_NOTNULL(slave);
+ CHECK(slave != nullptr) << operation->slave_id();
// Orphaned operations are handled differently, because the allocator
// has no knowledge of resources consumed by these operations;
@@ -12231,7 +12234,7 @@ void Master::removeOperation(Operation* operation)
<< "External resource provider is not supported yet";
Slave* slave = slaves.registered.get(operation->slave_id());
- CHECK_NOTNULL(slave);
+ CHECK(slave != nullptr) << operation->slave_id();
slave->removeOperation(operation);