You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2017/08/24 22:15:54 UTC

[1/2] mesos git commit: Propagate the error from os::rmdir.

Repository: mesos
Updated Branches:
  refs/heads/master 2efdde117 -> 09b1625b5


Propagate the error from os::rmdir.

Even when os::rmdir() is given the continueOnError flag, it should still
propagate a failure if it gets one. If we don't do this, the caller has
no way to detect and handle it.

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


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

Branch: refs/heads/master
Commit: be8d7c2a6747c71127d4712a7ac88d789bdc9ccd
Parents: 2efdde1
Author: James Peach <jp...@apache.org>
Authored: Thu Aug 24 15:15:04 2017 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Thu Aug 24 15:15:04 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/posix/rmdir.hpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/be8d7c2a/3rdparty/stout/include/stout/os/posix/rmdir.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/rmdir.hpp b/3rdparty/stout/include/stout/os/posix/rmdir.hpp
index 2427bd2..947bb24 100644
--- a/3rdparty/stout/include/stout/os/posix/rmdir.hpp
+++ b/3rdparty/stout/include/stout/os/posix/rmdir.hpp
@@ -22,6 +22,7 @@
 #include <stout/error.hpp>
 #include <stout/nothing.hpp>
 #include <stout/path.hpp>
+#include <stout/stringify.hpp>
 #include <stout/try.hpp>
 
 #include <stout/os/exists.hpp>
@@ -45,6 +46,8 @@ inline Try<Nothing> rmdir(
     bool removeRoot = true,
     bool continueOnError = false)
 {
+  unsigned int errorCount = 0;
+
   if (!recursive) {
     if (::rmdir(directory.c_str()) < 0) {
       return ErrnoError();
@@ -81,6 +84,7 @@ inline Try<Nothing> rmdir(
               LOG(ERROR) << "Failed to delete directory "
                          << path::join(directory, node->fts_path)
                          << ": " << os::strerror(errno);
+              ++errorCount;
             } else {
               Error error = ErrnoError();
               fts_close(tree);
@@ -101,6 +105,7 @@ inline Try<Nothing> rmdir(
               LOG(ERROR) << "Failed to delete path "
                          << path::join(directory, node->fts_path)
                          << ": " << os::strerror(errno);
+              ++errorCount;
             } else {
               Error error = ErrnoError();
               fts_close(tree);
@@ -113,11 +118,8 @@ inline Try<Nothing> rmdir(
       }
     }
 
-    // If 'continueOnError' is true, we have already logged individual errors.
     if (errno != 0) {
-      Error error = continueOnError
-        ? Error("rmdir failed in 'continueOnError' mode")
-        : ErrnoError();
+      Error error = ErrnoError("fts_read failed");
       fts_close(tree);
       return error;
     }
@@ -127,6 +129,10 @@ inline Try<Nothing> rmdir(
     }
   }
 
+  if (errorCount > 0) {
+    return Error("Failed to delete " + stringify(errorCount) + " paths");
+  }
+
   return Nothing();
 }
 #endif // __sun


[2/2] mesos git commit: Fix garbage collection metrics test failures.

Posted by ya...@apache.org.
Fix garbage collection metrics test failures.

If we fail to garbage collect a path, verify that the failure is
recorded but don't depend on how many failures we encounter. This
ensures that we check what is important but don't bind to specific
values in a brittle wway.

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


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

Branch: refs/heads/master
Commit: 09b1625b5d83d6ade747b2cf0948c085a75f77c8
Parents: be8d7c2
Author: James Peach <jp...@apache.org>
Authored: Thu Aug 24 15:15:17 2017 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Thu Aug 24 15:15:17 2017 -0700

----------------------------------------------------------------------
 src/tests/gc_tests.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/09b1625b/src/tests/gc_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/gc_tests.cpp b/src/tests/gc_tests.cpp
index f451b2c..da9a31c 100644
--- a/src/tests/gc_tests.cpp
+++ b/src/tests/gc_tests.cpp
@@ -1004,7 +1004,7 @@ TEST_F(GarbageCollectorIntegrationTest, ROOT_BusyMountPoint)
   EXPECT_TRUE(os::exists(path::join(sandbox, mountPoint)));
   EXPECT_FALSE(os::exists(path::join(sandbox, regularFile)));
 
-  // Verify that GC metrics show that we performed 1 path removal that failed.
+  // Verify that GC metrics show that a path removal failed.
   JSON::Object metrics = Metrics();
 
   ASSERT_EQ(1u, metrics.values.count("gc/path_removals_pending"));
@@ -1017,9 +1017,14 @@ TEST_F(GarbageCollectorIntegrationTest, ROOT_BusyMountPoint)
   EXPECT_SOME_EQ(
       0u,
       metrics.at<JSON::Number>("gc/path_removals_succeeded"));
-  EXPECT_SOME_EQ(
-      1u,
-      metrics.at<JSON::Number>("gc/path_removals_failed"));
+
+  // The sandbox path removal failure will cascade to cause failures to
+  // remove the executor and framework directories. For testing purposes
+  // it is sufficient to verify that some failure was detected.
+  ASSERT_SOME(metrics.at<JSON::Number>("gc/path_removals_failed"));
+  EXPECT_GT(
+      metrics.at<JSON::Number>("gc/path_removals_failed")->as<unsigned>(),
+      0u);
 
   Clock::resume();
   driver.stop();