Fixed master's `updateOperation` for operations without framework ID. This patch fixes logging of master's `updateOperation` for operations without framework ID. We also add a `CHECK` before the part updating resources or the allocator for non-speculated operations; currently non-speculated operations can only be initiated from a framework, but not from e.g., the operation API, and additional work is needed to support this.
Review: https://reviews.apache.org/r/65096/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7ffe111d Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7ffe111d Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7ffe111d Branch: refs/heads/1.5.x Commit: 7ffe111da8f40806a3bf65c6b7312b7f778741b9 Parents: 2edd931 Author: Benjamin Bannier <[email protected]> Authored: Fri Jan 12 15:40:42 2018 -0800 Committer: Greg Mann <[email protected]> Committed: Fri Jan 12 17:17:39 2018 -0800 ---------------------------------------------------------------------- src/master/master.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/7ffe111d/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index 32a955e..1564506 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -10324,9 +10324,11 @@ void Master::updateOperation( const OperationStatus& status = update.has_latest_status() ? update.latest_status() : update.status(); - LOG(INFO) << "Updating the state of operation '" - << operation->info().id() << "' (uuid: " << update.operation_uuid() - << ") of framework " << operation->framework_id() + LOG(INFO) << "Updating the state of operation '" << operation->info().id() + << "' (uuid: " << update.operation_uuid() << ") for" + << (operation->has_framework_id() + ? " framework " + stringify(operation->framework_id()) + : " an operator API call") << " (latest state: " << operation->latest_status().state() << ", status update state: " << status.state() << ")"; @@ -10358,6 +10360,10 @@ void Master::updateOperation( return; } + // We currently do not support non-speculated operations not + // triggered by a framework (e.g., over the operator API). + CHECK(operation->has_framework_id()); + Try<Resources> consumed = protobuf::getConsumedResources(operation->info()); CHECK_SOME(consumed); @@ -10433,9 +10439,7 @@ void Master::updateOperation( slave->recoverResources(operation); - Framework* framework = operation->has_framework_id() - ? getFramework(operation->framework_id()) - : nullptr; + Framework* framework = getFramework(operation->framework_id()); if (framework != nullptr) { framework->recoverResources(operation);
