You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by zh...@apache.org on 2018/06/12 21:06:06 UTC

[2/3] mesos git commit: Skipped metric for non existing paths in gc.

Skipped metric for non existing paths in gc.

Previously, agent gc would increment the "failed" counter if the path
does not exist, but this should not be an issue. This patch skipped such
paths in both "failed" and "succeeded" counters.

Review: https://reviews.apache.org/r/67423


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/644ffc8e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/644ffc8e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/644ffc8e

Branch: refs/heads/master
Commit: 644ffc8e4b273afc0cdcb4053d8efa82d112d1b4
Parents: db2d1c2
Author: Zhitao Li <zh...@gmail.com>
Authored: Fri Jun 1 22:09:11 2018 -0700
Committer: Zhitao Li <zh...@gmail.com>
Committed: Tue Jun 12 13:20:02 2018 -0700

----------------------------------------------------------------------
 src/slave/gc.cpp | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/644ffc8e/src/slave/gc.cpp
----------------------------------------------------------------------
diff --git a/src/slave/gc.cpp b/src/slave/gc.cpp
index 8770d88..407f6b2 100644
--- a/src/slave/gc.cpp
+++ b/src/slave/gc.cpp
@@ -271,11 +271,17 @@ void GarbageCollectorProcess::remove(const Timeout& removalTime)
         Try<Nothing> rmdir = os::rmdir(info->path, true, true, true);
 
         if (rmdir.isError()) {
-          LOG(WARNING) << "Failed to delete '" << info->path << "': "
-                       << rmdir.error();
-          info->promise.fail(rmdir.error());
-
-          ++failed;
+          // TODO(zhitao): Change return value type of `rmdir` to
+          // `Try<Nothing, ErrnoError>` and check error type instead.
+          if (rmdir.error() == ErrnoError(ENOENT).message) {
+            LOG(INFO) << "Skipped '" << info->path << "' which does not exist";
+          } else {
+            LOG(WARNING) << "Failed to delete '" << info->path << "': "
+                         << rmdir.error();
+            info->promise.fail(rmdir.error());
+
+            ++failed;
+          }
         } else {
           LOG(INFO) << "Deleted '" << info->path << "'";
           info->promise.set(rmdir.get());