This is an automated email from the ASF dual-hosted git repository.

vinodkone pushed a commit to branch 1.5.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit f049981470791c59e48732930fd24110af5e2c75
Author: Vinod Kone <vinodk...@gmail.com>
AuthorDate: Sat Feb 2 10:01:56 2019 -0600

    Removed unreachable tasks from `Master::Framework` on agent GC.
    
    NOTE: Modified code during cherry-picking.
    
    Unreachable tasks are stored in `Framework` struct of the master, but
    they were not removed when an unreachable agent is GCed from the
    registry. This patch fixes it so that the unreachable tasks are also
    cleaned up.
    
    Review: https://reviews.apache.org/r/69908
---
 src/master/master.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/master/master.cpp b/src/master/master.cpp
index c22caf3..995ff55 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -1956,6 +1956,21 @@ void Master::_doRegistryGc(
     }
 
     slaves.unreachable.erase(slaveId);
+
+    // TODO(vinod): Consider moving these tasks into `completedTasks` by
+    // transitioning them to a terminal state and sending status updates.
+    // But it's not clear what this state should be. If a framework
+    // reconciles these tasks after this point it would get `TASK_UNKNOWN`
+    // which seems appropriate but we don't keep tasks in this state in-memory.
+    foreachvalue (Framework* framework, frameworks.registered) {
+      foreach (const TaskID& taskId, framework->unreachableTasks.keys()) {
+        const Owned<Task>& task = framework->unreachableTasks.at(taskId);
+        if (task->slave_id() ==  slaveId) {
+          framework->unreachableTasks.erase(taskId);
+        }
+      }
+    }
+
     numRemovedUnreachable++;
   }
 

Reply via email to