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/05/09 00:07:02 UTC

[1/2] mesos git commit: Added new 'any' setting for reconfiguration_policy flag.

Repository: mesos
Updated Branches:
  refs/heads/reconfiguration_policy_any [created] d4ad8f1d5


Added new 'any' setting for reconfiguration_policy flag.

This setting allows any state change, effectively telling
agents to ignore the existing state and not to run any
new tasks until the existing ones fit into the
new provided resources.

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


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

Branch: refs/heads/reconfiguration_policy_any
Commit: c62fe46f549bc448c56168bf4c2421b62e116fbb
Parents: 86523d3
Author: Zhitao Li <zh...@gmail.com>
Authored: Tue Feb 20 13:18:49 2018 -0800
Committer: Zhitao Li <zh...@gmail.com>
Committed: Tue May 8 16:56:58 2018 -0700

----------------------------------------------------------------------
 src/slave/compatibility.cpp |  8 ++++++++
 src/slave/compatibility.hpp | 13 +++++++++++++
 src/slave/flags.cpp         |  3 ++-
 src/slave/slave.cpp         |  6 +++++-
 4 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c62fe46f/src/slave/compatibility.cpp
----------------------------------------------------------------------
diff --git a/src/slave/compatibility.cpp b/src/slave/compatibility.cpp
index 5551d93..29c4f3a 100644
--- a/src/slave/compatibility.cpp
+++ b/src/slave/compatibility.cpp
@@ -51,6 +51,14 @@ Try<Nothing> equal(
 }
 
 
+Try<Nothing> any(
+    const SlaveInfo& previous,
+    const SlaveInfo& current)
+{
+  return Nothing();
+}
+
+
 Try<Nothing> additive(
     const SlaveInfo& previous,
     const SlaveInfo& current)

http://git-wip-us.apache.org/repos/asf/mesos/blob/c62fe46f/src/slave/compatibility.hpp
----------------------------------------------------------------------
diff --git a/src/slave/compatibility.hpp b/src/slave/compatibility.hpp
index de21fd6..4140015 100644
--- a/src/slave/compatibility.hpp
+++ b/src/slave/compatibility.hpp
@@ -60,6 +60,19 @@ Try<Nothing> additive(
     const SlaveInfo& previous,
     const SlaveInfo& current);
 
+
+// This function checks whether the changes between `previous` and `current`
+// are considered compatible under the "any" policy, as given by the table
+// below:
+//
+// Field      | Constraint
+// -----------------------------------------------------------------------------
+// *          | No restriction
+
+Try<Nothing> any(
+    const SlaveInfo& previous,
+    const SlaveInfo& current);
+
 } // namespace compatibility {
 } // namespace slave {
 } // namespace internal {

http://git-wip-us.apache.org/repos/asf/mesos/blob/c62fe46f/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index a319b5e..f8f9353 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -506,7 +506,8 @@ mesos::internal::slave::Flags::Flags()
       "equal:    The old and the new state must match exactly.\n"
       "additive: The new state must be a superset of the old state:\n"
       "          it is permitted to add additional resources, attributes\n"
-      "          and domains but not to remove or to modify existing ones.\n"
+      "          and domains but not to remove existing ones.\n"
+      "any:      Permit all changes. This setting is currently experimental.\n"
       "Note that this only affects the checking done on the agent itself,\n"
       "the master may still reject the agent if it detects a change that it\n"
       "considers unacceptable, which, e.g., currently happens when port or\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/c62fe46f/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index c6d9152..c008a17 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -887,7 +887,8 @@ void Slave::initialize()
 
   // Check that the reconfiguration_policy flag is valid.
   if (flags.reconfiguration_policy != "equal" &&
-      flags.reconfiguration_policy != "additive") {
+      flags.reconfiguration_policy != "additive" &&
+      flags.reconfiguration_policy != "any") {
     EXIT(EXIT_FAILURE)
       << "Unknown option for 'reconfiguration_policy' flag "
       << flags.reconfiguration_policy << "."
@@ -6856,6 +6857,9 @@ Try<Nothing> Slave::compatible(
   const SlaveInfo& current) const
 {
   // TODO(vinod): Also check for version compatibility.
+  if (flags.reconfiguration_policy == "any") {
+    return compatibility::any(previous, current);
+  }
 
   if (flags.reconfiguration_policy == "equal") {
     return compatibility::equal(previous, current);


[2/2] mesos git commit: Refreshed checkpointed SlaveInfo if `--reconfiguration_policy==any`.

Posted by zh...@apache.org.
Refreshed checkpointed SlaveInfo if `--reconfiguration_policy==any`.


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

Branch: refs/heads/reconfiguration_policy_any
Commit: d4ad8f1d5a1ded50f86ee44482c59045df016957
Parents: c62fe46
Author: Zhitao Li <zh...@gmail.com>
Authored: Tue May 8 17:01:32 2018 -0700
Committer: Zhitao Li <zh...@gmail.com>
Committed: Tue May 8 17:06:42 2018 -0700

----------------------------------------------------------------------
 src/slave/slave.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d4ad8f1d/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index c008a17..5dfd041 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -1600,6 +1600,20 @@ void Slave::reregistered(
   switch (state) {
     case DISCONNECTED:
       LOG(INFO) << "Re-registered with master " << master.get();
+
+      // Agent is running a different `SlaveInfo` from recovered. This was
+      // permitted by `flags.reconfiguration_policy` but we want to correct the
+      // checkpointed info.
+      if (requiredMasterCapabilities.agentUpdate &&
+          flags.reconfiguration_policy == "any") {
+        // Checkpoint reconfigured slave info.
+        const string path = paths::getSlaveInfoPath(metaDir, slaveId);
+
+        LOG(INFO) << "Checkpointing reconfigured SlaveInfo to '" << path << "'";
+
+        CHECK_SOME(state::checkpoint(path, info));
+      }
+
       state = RUNNING;
       taskStatusUpdateManager->resume(); // Resume status updates.