Detached the virtual paths regardless of the result of gc. Previously we only detach the following paths when the gc for the executor's sandbox succeeds. 1. /agent_workdir/frameworks/FID/executors/EID/runs/CID 2. /agent_workdir/frameworks/FID/executors/EID/runs/latest 3. /frameworks/FID/executors/EID/runs/latest
But the problem is, such gc may not always succeed, e.g., it may fail due to the parent directory of the executor's sandbox already gc'ed. Now in this patch, we will detach those paths regardless of the result of gc. Review: https://reviews.apache.org/r/65156 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a198637d Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a198637d Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a198637d Branch: refs/heads/1.5.x Commit: a198637d3805765d11a2474b3a66097592c9b065 Parents: af64bcb Author: Qian Zhang <[email protected]> Authored: Sun Jan 14 22:02:33 2018 +0800 Committer: Qian Zhang <[email protected]> Committed: Wed Jan 17 11:55:36 2018 +0800 ---------------------------------------------------------------------- src/slave/slave.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/a198637d/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 3e7281f..aefea9c 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -5871,7 +5871,7 @@ void Slave::removeExecutor(Framework* framework, Executor* executor) os::utime(path); // Update the modification time. garbageCollect(path) - .then(defer(self(), &Self::detachFile, path)); + .onAny(defer(self(), &Self::detachFile, path)); // Schedule the top level executor work directory, only if the // framework doesn't have any 'pending' tasks for this executor. @@ -5895,10 +5895,9 @@ void Slave::removeExecutor(Framework* framework, Executor* executor) os::utime(path); // Update the modification time. garbageCollect(path) - .then(defer(self(), [=]() { + .onAny(defer(self(), [=](const Future<Nothing>& future) { detachFile(latestPath); detachFile(virtualLatestPath); - return Nothing(); })); } @@ -8599,7 +8598,7 @@ void Framework::recoverExecutor( slave->flags.work_dir, slave->info.id(), id(), state.id, runId); slave->garbageCollect(path) - .then(defer(slave, &Slave::detachFile, path)); + .onAny(defer(slave, &Slave::detachFile, path)); // GC the executor run's meta directory. slave->garbageCollect(paths::getExecutorRunPath( @@ -8608,7 +8607,7 @@ void Framework::recoverExecutor( // GC the top level executor work directory. slave->garbageCollect(paths::getExecutorPath( slave->flags.work_dir, slave->info.id(), id(), state.id)) - .then(defer(slave, &Slave::detachFile, latestPath)); + .onAny(defer(slave, &Slave::detachFile, latestPath)); // GC the top level executor meta directory. slave->garbageCollect(paths::getExecutorPath(
