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

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

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

    Removed unreachable tasks from `Master::Framework` on agent GC.
    
    Unreachable tasks are stored in `Slaves` and `Framework` structs of
    the master, but they were only being removed from the former when
    an unreachable agent is GCed from the registry. This patch fixes it
    so that the latter is also cleaned up.
    
    Review: https://reviews.apache.org/r/69908
---
 src/master/master.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/master/master.cpp b/src/master/master.cpp
index 4870227..106d924 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -1875,7 +1875,27 @@ 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.
+    if (slaves.unreachableTasks.contains(slaveId)) {
+      foreachkey (const FrameworkID& frameworkId,
+                  slaves.unreachableTasks.at(slaveId)) {
+        Framework* framework = getFramework(frameworkId);
+        if (framework != nullptr) {
+          foreach (const TaskID& taskId,
+                   slaves.unreachableTasks.at(slaveId).get(frameworkId)) {
+            framework->unreachableTasks.erase(taskId);
+          }
+        }
+      }
+    }
+
     slaves.unreachableTasks.erase(slaveId);
+
     numRemovedUnreachable++;
   }
 

Reply via email to