Repository: mesos Updated Branches: refs/heads/master 7a3c63fe1 -> d58e6351b
Fixed handling of operations in `master::recoverFramework()`. `Master::recoverFramework()` only recovers operations affecting agent default resources. This patch makes it also recover operations affecting resources managed by resource providers. It also fixes a bug in which not just the corresponding operations, but all the ones affecting agent default resources will be added to the framework. Review: https://reviews.apache.org/r/66458/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/470476c4 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/470476c4 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/470476c4 Branch: refs/heads/master Commit: 470476c4e2574d5711bab2b5bd10e851e2314516 Parents: 7a3c63f Author: Gaston Kleiman <[email protected]> Authored: Mon Apr 23 13:43:17 2018 -0700 Committer: Greg Mann <[email protected]> Committed: Mon Apr 23 13:44:19 2018 -0700 ---------------------------------------------------------------------- src/master/master.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/470476c4/src/master/master.cpp ---------------------------------------------------------------------- diff --git a/src/master/master.cpp b/src/master/master.cpp index 767ad8c..5946c7b 100644 --- a/src/master/master.cpp +++ b/src/master/master.cpp @@ -9491,7 +9491,7 @@ void Master::recoverFramework( Framework* framework = new Framework(this, flags, info); - // Add active tasks and executors to the framework. + // Add active operations, tasks, and executors to the framework. foreachvalue (Slave* slave, slaves.registered) { if (slave->tasks.contains(framework->id())) { foreachvalue (Task* task, slave->tasks.at(framework->id())) { @@ -9507,7 +9507,20 @@ void Master::recoverFramework( } foreachvalue (Operation* operation, slave->operations) { - framework->addOperation(operation); + if (operation->has_framework_id() && + operation->framework_id() == framework->id()) { + framework->addOperation(operation); + } + } + + foreachvalue (const Slave::ResourceProvider& resourceProvider, + slave->resourceProviders) { + foreachvalue (Operation* operation, resourceProvider.operations) { + if (operation->has_framework_id() && + operation->framework_id() == framework->id()) { + framework->addOperation(operation); + } + } } }
