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 2016/10/28 18:02:22 UTC

[1/2] mesos git commit: Avoided CHECK failure with pre-1.0 agents.

Repository: mesos
Updated Branches:
  refs/heads/1.1.x d9236ab50 -> 55322e7a2


Avoided CHECK failure with pre-1.0 agents.

We don't guarantee compatibility with pre-1.0 agents. However, since it
is easy to avoid a CHECK failure in the master when an old agent
re-registers, it seems worth doing so.

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


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

Branch: refs/heads/1.1.x
Commit: b18c5ccdbfcfea133fe366c82dc0578c948134b9
Parents: d9236ab
Author: Neil Conway <ne...@gmail.com>
Authored: Thu Oct 27 14:16:01 2016 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Fri Oct 28 11:01:08 2016 -0700

----------------------------------------------------------------------
 src/master/master.cpp | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b18c5ccd/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 0d50268..bb61827 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -5987,18 +5987,29 @@ void Master::_markUnreachable(
     // its FrameworkInfo will be in the `recovered` collection. Note that
     // if the master knows about a task, its FrameworkInfo must appear in
     // either the `registered` or `recovered` collections.
-    FrameworkInfo frameworkInfo;
+    //
+    // NOTE: If the framework is only running tasks on pre-1.0 agents
+    // and the framework hasn't yet re-registered, its FrameworkInfo
+    // will not appear in `recovered`. We can't accurately determine
+    // whether the framework is partition-aware; we assume it is NOT
+    // partition-aware, since using TASK_LOST ensures compatibility
+    // with the previous (and default) Mesos behavior.
+    Option<FrameworkInfo> frameworkInfo;
 
-    if (framework == nullptr) {
-      CHECK(frameworks.recovered.contains(frameworkId));
+    if (framework != nullptr) {
+      frameworkInfo = framework->info;
+    } else if (frameworks.recovered.contains(frameworkId)) {
       frameworkInfo = frameworks.recovered[frameworkId];
     } else {
-      frameworkInfo = framework->info;
+      LOG(WARNING) << "Unable to determine if framework " << frameworkId
+                   << " is partition-aware, because the cluster contains"
+                   << " agents running an old version of Mesos; upgrading"
+                   << " the agents to Mesos 1.0 or later is recommended";
     }
 
     TaskState newTaskState = TASK_UNREACHABLE;
-    if (!protobuf::frameworkHasCapability(
-            frameworkInfo, FrameworkInfo::Capability::PARTITION_AWARE)) {
+    if (frameworkInfo.isNone() || !protobuf::frameworkHasCapability(
+            frameworkInfo.get(), FrameworkInfo::Capability::PARTITION_AWARE)) {
       newTaskState = TASK_LOST;
     }
 


[2/2] mesos git commit: Fixed master that leaks empty entries in its hashmaps.

Posted by ya...@apache.org.
Fixed master that leaks empty entries in its hashmaps.

This fixes the CHECK failure mentioned in MESOS-6482.

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


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

Branch: refs/heads/1.1.x
Commit: 55322e7a206618e04109f462986c6a550afbd352
Parents: b18c5cc
Author: Jiang Yan Xu <xu...@apple.com>
Authored: Thu Oct 27 13:30:24 2016 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Fri Oct 28 11:01:50 2016 -0700

----------------------------------------------------------------------
 src/master/master.cpp | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/55322e7a/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index bb61827..b57dd13 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2462,12 +2462,17 @@ void Master::_subscribe(
 
     // Add active tasks and executors to the framework.
     foreachvalue (Slave* slave, slaves.registered) {
-      foreachvalue (Task* task, slave->tasks[framework->id()]) {
-        framework->addTask(task);
+      if (slave->tasks.contains(framework->id())) {
+        foreachvalue (Task* task, slave->tasks.at(framework->id())) {
+          framework->addTask(task);
+        }
       }
-      foreachvalue (const ExecutorInfo& executor,
-                    slave->executors[framework->id()]) {
-        framework->addExecutor(slave->id, executor);
+
+      if (slave->executors.contains(framework->id())) {
+        foreachvalue (const ExecutorInfo& executor,
+                      slave->executors.at(framework->id())) {
+          framework->addExecutor(slave->id, executor);
+        }
       }
     }
 
@@ -2800,12 +2805,17 @@ void Master::_subscribe(
 
     // Add active tasks and executors to the framework.
     foreachvalue (Slave* slave, slaves.registered) {
-      foreachvalue (Task* task, slave->tasks[framework->id()]) {
-        framework->addTask(task);
+      if (slave->tasks.contains(framework->id())) {
+        foreachvalue (Task* task, slave->tasks.at(framework->id())) {
+          framework->addTask(task);
+        }
       }
-      foreachvalue (const ExecutorInfo& executor,
-                    slave->executors[framework->id()]) {
-        framework->addExecutor(slave->id, executor);
+
+      if (slave->executors.contains(framework->id())) {
+        foreachvalue (const ExecutorInfo& executor,
+                      slave->executors.at(framework->id())) {
+          framework->addExecutor(slave->id, executor);
+        }
       }
     }