You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2017/08/28 23:46:49 UTC

[1/2] mesos git commit: Fixed the communication between old masters and new agents.

Repository: mesos
Updated Branches:
  refs/heads/1.4.x 2a785ce10 -> 718364ccd


Fixed the communication between old masters and new agents.

For re-registration, 1.4 agents used to send the resources in tasks
and executors to the master in the "post-reservation-refinement" format,
which is incompatible for pre-1.4 masters. This patch changes the agent
such that it always downgrades the resources to
the "pre-reservation-refinement" format, and the master unconditionally
upgrades the resources to "post-reservation-refinement" format.

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


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

Branch: refs/heads/1.4.x
Commit: 5ad8e26390597bbb8e6f9c6285c38dd9bfa84f42
Parents: 2a785ce
Author: Michael Park <mp...@apache.org>
Authored: Mon Aug 28 15:19:31 2017 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Mon Aug 28 16:42:57 2017 -0700

----------------------------------------------------------------------
 src/master/master.cpp | 39 ++++++++++++++++-----------------------
 src/slave/slave.cpp   | 24 ++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5ad8e263/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index a9d2191..183f530 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -6345,31 +6345,24 @@ void Master::__reregisterSlave(
     }
   }
 
-  // If the agent is not refinement-capable, convert its resources
-  // from the "pre-refinement" format to the "post-refinement" format.
-  //
-  // TODO(neilc): The agent should be changed to send resources in
-  // pre-refinement format if possible, for compatibility with old
-  // masters. After that change is made, we should change this logic
-  // to convert the agent resources to post-refinement format
-  // unconditionally.
-  if (!slaveCapabilities.reservationRefinement) {
-    foreach (Task& task, tasks) {
-      convertResourceFormat(
-          task.mutable_resources(), POST_RESERVATION_REFINEMENT);
-    }
+  // Currently, The agent always downgrades the resources such that
+  // a 1.4.0 agent can speak to a pre-1.4.0 master. We therefore
+  // unconditionally upgrade the resources back here.
+  foreach (Task& task, tasks) {
+    convertResourceFormat(
+        task.mutable_resources(), POST_RESERVATION_REFINEMENT);
+  }
 
-    foreach (ExecutorInfo& executor, executorInfos) {
-      convertResourceFormat(
-          executor.mutable_resources(), POST_RESERVATION_REFINEMENT);
-    }
+  foreach (ExecutorInfo& executor, executorInfos) {
+    convertResourceFormat(
+        executor.mutable_resources(), POST_RESERVATION_REFINEMENT);
+  }
 
-    foreach (Archive::Framework& completedFramework,
-             completedFrameworks) {
-      foreach (Task& task, *completedFramework.mutable_tasks()) {
-        convertResourceFormat(
-            task.mutable_resources(), POST_RESERVATION_REFINEMENT);
-      }
+  foreach (Archive::Framework& completedFramework,
+           completedFrameworks) {
+    foreach (Task& task, *completedFramework.mutable_tasks()) {
+      convertResourceFormat(
+          task.mutable_resources(), POST_RESERVATION_REFINEMENT);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/5ad8e263/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index f08b722..9c8757f 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -1569,6 +1569,30 @@ void Slave::doReliableRegistration(Duration maxBackoff)
       }
     }
 
+    // If the resources don't have reservation refinements, send them
+    // to the master in "pre-reservation-refinement" format for backward
+    // compatibility with old masters. If downgrading is not possible
+    // without losing information, send the resources in the
+    // "post-reservation-refinement" format. We ignore the return value of
+    // `downgradeResources` because for now, we send the result either way.
+    //
+    // TODO(mpark): Do something smarter with the result once something
+    // like a master capability is introduced.
+    foreach (Task& task, *message.mutable_tasks()) {
+      downgradeResources(task.mutable_resources());
+    }
+
+    foreach (ExecutorInfo& executor, *message.mutable_executor_infos()) {
+      downgradeResources(executor.mutable_resources());
+    }
+
+    foreach (Archive::Framework& completedFramework,
+             *message.mutable_completed_frameworks()) {
+      foreach (Task& task, *completedFramework.mutable_tasks()) {
+        downgradeResources(task.mutable_resources());
+      }
+    }
+
     CHECK_SOME(master);
     send(master.get(), message);
   }


[2/2] mesos git commit: Added MESOS-7922 to the 1.4.0 CHANGELOG.

Posted by mp...@apache.org.
Added MESOS-7922 to the 1.4.0 CHANGELOG.


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

Branch: refs/heads/1.4.x
Commit: 718364ccd6f503901bdc0d3c5306d5ad15aab921
Parents: 5ad8e26
Author: Michael Park <mp...@apache.org>
Authored: Mon Aug 28 16:46:38 2017 -0700
Committer: Michael Park <mp...@apache.org>
Committed: Mon Aug 28 16:46:38 2017 -0700

----------------------------------------------------------------------
 CHANGELOG | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/718364cc/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index f5b7e9a..084209a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -168,6 +168,7 @@ All Resolved Issues:
   * [MESOS-7871] - Agent fails assertion during request to '/state'
   * [MESOS-7888] - Track fetcher task success and failures
   * [MESOS-7909] - Ordering dependency between 'linux/capabilities' and 'docker/runtime' isolator.
+  * [MESOS-7922] - Fix communication between old masters and new agents.
 
 ** Documentation
   * [MESOS-7246] - Add documentation for AGENT_ADDED/AGENT_REMOVED events.