Repository: mesos Updated Branches: refs/heads/master f7858bb3a -> c035e7e87
Made sure only non-terminal operations use resources. The function 'addOfferOperation' is a high-level function which can be used to some extent manage the offer operation life cycle in the master. In addition to managing the lifetime of offer operations, it also maintains the state of used resources. We already made sure to never count speculated operations as using resources in this function. In addition, the function 'updateOfferOperation' is already capable of updating the used resources when an offer operation becomes terminal. To complete this division of responsibilities we in this patch extend the conditional treatment in 'removeOfferOperation' to also take into account whether the operation is terminal when deciding on whether to mutate the used resources. Review: https://reviews.apache.org/r/64163/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/567f250e Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/567f250e Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/567f250e Branch: refs/heads/master Commit: 567f250e5b7af391b7ba17c2b5e3395daa03d017 Parents: f7858bb Author: Benjamin Bannier <[email protected]> Authored: Thu Nov 30 17:03:18 2017 +0100 Committer: Benjamin Bannier <[email protected]> Committed: Thu Nov 30 18:33:57 2017 +0100 ---------------------------------------------------------------------- src/master/master.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/567f250e/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index fadc78b..3470db9 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -10847,7 +10847,8 @@ void Slave::addOfferOperation(OfferOperation* operation) offerOperations.put(uuid.get(), operation); - if (!protobuf::isSpeculativeOperation(operation->info())) { + if (!protobuf::isSpeculativeOperation(operation->info()) && + !protobuf::isTerminalState(operation->latest_status().state())) { Try<Resources> consumed = protobuf::getConsumedResources(operation->info()); CHECK_SOME(consumed);
