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/5225a49c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5225a49c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5225a49c Branch: refs/heads/master Commit: 5225a49c495bc7e3362bcee2d460d8c99111c7f4 Parents: 9e2f9a2 Author: Qian Zhang <[email protected]> Authored: Sun Jan 14 22:02:33 2018 +0800 Committer: Qian Zhang <[email protected]> Committed: Wed Jan 17 10:04:30 2018 +0800 ---------------------------------------------------------------------- src/slave/slave.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/5225a49c/src/slave/slave.cpp ---------------------------------------------------------------------- diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp index 5ad6410..155d9f0 100644 --- a/src/slave/slave.cpp +++ b/src/slave/slave.cpp @@ -5873,7 +5873,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. @@ -5897,10 +5897,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(); })); } @@ -8615,7 +8614,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( @@ -8624,7 +8623,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(
