You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2018/09/05 05:47:43 UTC

[mesos] 01/05: Enabled garbage collection of terminated tasks' metadata.

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

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

commit 322975f1254344b589aa7db6de443643b4ba79e1
Author: Joseph Wu <jo...@apache.org>
AuthorDate: Tue Jul 24 13:43:29 2018 -0700

    Enabled garbage collection of terminated tasks' metadata.
    
    This commit schedules tasks' metadata, whose terminal statuses have been
    acknowledged, for garbage collection.  GC occurs according to the
    existing GC policy (controlled by agent flags --gc_delay and
    --gc_disk_headroom).  This change helps mitigate potential accumulation
    of directories for long-lived, multi-task executors, such as the
    default executor.
    
    Review: https://reviews.apache.org/r/68065
---
 src/slave/slave.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 3bd808e..9d84dcb 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -9664,6 +9664,19 @@ void Executor::completeTask(const TaskID& taskId)
     slave->detachTaskVolumeDirectories(info, containerId, {*firstTask});
   }
 
+  // Mark the task metadata (TaskInfo and status updates) for garbage
+  // collection. This is important for keeping the metadata of long-lived,
+  // multi-task executors within reasonable levels.
+  if (checkpoint) {
+    slave->garbageCollect(paths::getTaskPath(
+        slave->metaDir,
+        slave->info.id(),
+        frameworkId,
+        id,
+        containerId,
+        taskId));
+  }
+
   Task* task = terminatedTasks[taskId];
   completedTasks.push_back(shared_ptr<Task>(task));
   terminatedTasks.erase(taskId);