You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2015/03/03 01:07:15 UTC
mesos git commit: Fixed Master::finalize() to remove slaves and
frameworks from the allocator.
Repository: mesos
Updated Branches:
refs/heads/master f4a14410d -> 11c357bf0
Fixed Master::finalize() to remove slaves and frameworks from the allocator.
Short term fix for MESOS-2403.
Review: https://reviews.apache.org/r/31644
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/11c357bf
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/11c357bf
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/11c357bf
Branch: refs/heads/master
Commit: 11c357bf07e7cbe381a6786aaefb9f5460b68c35
Parents: f4a1441
Author: Vinod Kone <vi...@gmail.com>
Authored: Mon Mar 2 14:19:37 2015 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Mon Mar 2 16:06:37 2015 -0800
----------------------------------------------------------------------
src/master/master.cpp | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/11c357bf/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 53c8696..dae0955 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -760,9 +760,20 @@ void Master::finalize()
{
LOG(INFO) << "Master terminating";
+ // NOTE: Even though we remove the slave and framework from the
+ // allocator, it is possible that offers are already dispatched to
+ // this master. In tests, if a new master (with the same PID) is
+ // started, it might process the offers from the old master's
+ // allocator.
+ // TODO(vinod): Fix the above race by changing the allocator
+ // interface to return a stream of offer events.
+
// Remove the slaves.
foreachvalue (Slave* slave, slaves.registered) {
- // Remove tasks, don't bother recovering resources.
+ // We first remove the slave from the allocator so that any
+ // recovered resources below are not reoffered.
+ allocator->removeSlave(slave->id);
+
foreachkey (const FrameworkID& frameworkId, utils::copy(slave->tasks)) {
foreachvalue (Task* task, utils::copy(slave->tasks[frameworkId])) {
removeTask(task);
@@ -793,9 +804,11 @@ void Master::finalize()
// Remove the frameworks.
// Note we are not deleting the pointers to the frameworks from the
- // allocator or the roles because it is unnecessary bookkeeping at
- // this point since we are shutting down.
+ // roles because it is unnecessary bookkeeping at this point since
+ // we are shutting down.
foreachvalue (Framework* framework, frameworks.registered) {
+ allocator->removeFramework(framework->id);
+
// Remove pending tasks from the framework. Don't bother
// recovering the resources in the allocator.
framework->pendingTasks.clear();