You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jp...@apache.org on 2017/11/08 16:55:37 UTC

[1/3] mesos git commit: Added a test for ExecutorID validation in ReregisterSlaveMessage.

Repository: mesos
Updated Branches:
  refs/heads/1.4.x a2b346b98 -> b0448a4b5


Added a test for ExecutorID validation in ReregisterSlaveMessage.

Added a test to ensure that the ReregisterSlaveMessage validation
correctly allows duplicate ExecutorIDs as long as they are scoped
to different frameworks.

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


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

Branch: refs/heads/1.4.x
Commit: b6022a11286cdb38b8f1d97ac6fc446ab9a1a6f3
Parents: ed1f00e
Author: James Peach <jp...@apache.org>
Authored: Tue Nov 7 16:59:27 2017 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Nov 8 08:25:21 2017 -0800

----------------------------------------------------------------------
 src/tests/master_validation_tests.cpp | 46 ++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b6022a11/src/tests/master_validation_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_validation_tests.cpp b/src/tests/master_validation_tests.cpp
index 813fb25..27de34b 100644
--- a/src/tests/master_validation_tests.cpp
+++ b/src/tests/master_validation_tests.cpp
@@ -48,6 +48,8 @@
 #include "tests/mesos.hpp"
 #include "tests/resources_utils.hpp"
 
+#include "master/validation.hpp"
+
 #include "master/detector/standalone.hpp"
 
 using namespace mesos::internal::master::validation;
@@ -3972,6 +3974,50 @@ TEST_F(RegisterSlaveValidationTest, DropInvalidRegistration)
   Clock::settle();
 }
 
+
+// Test that duplicate ExecutorIDs are correctly handled when
+// validating the ReregisterSlaveMessage.
+TEST_F(RegisterSlaveValidationTest, DuplicateExecutorID)
+{
+  SlaveInfo slaveInfo;
+  slaveInfo.mutable_id()->set_value("agent-id");
+  slaveInfo.mutable_resources()->CopyFrom(
+      Resources::parse("cpus:2;mem:10").get());
+
+  vector<Task> tasks;
+  vector<Resource> resources;
+  vector<ExecutorInfo> executors;
+  vector<FrameworkInfo> frameworks;
+
+  frameworks.push_back(DEFAULT_FRAMEWORK_INFO);
+  frameworks.back().set_name("framework1");
+  frameworks.back().mutable_id()->set_value("framework1");
+
+  frameworks.push_back(DEFAULT_FRAMEWORK_INFO);
+  frameworks.back().set_name("framework2");
+  frameworks.back().mutable_id()->set_value("framework2");
+
+  executors.push_back(DEFAULT_EXECUTOR_INFO);
+  executors.back().mutable_framework_id()->set_value("framework1");
+
+  executors.push_back(DEFAULT_EXECUTOR_INFO);
+  executors.back().mutable_framework_id()->set_value("framework2");
+
+  // Executors with the same ID in different frameworks are allowed.
+  EXPECT_EQ(executors[0].executor_id(), executors[1].executor_id());
+  EXPECT_NE(executors[0].framework_id(), executors[1].framework_id());
+  EXPECT_NONE(master::validation::master::message::reregisterSlave(
+      slaveInfo, tasks, resources, executors, frameworks));
+
+  executors[1].mutable_framework_id()->set_value("framework1");
+
+  // Executors with the same ID in in the same framework are not allowed.
+  EXPECT_EQ(executors[0].executor_id(), executors[1].executor_id());
+  EXPECT_EQ(executors[0].framework_id(), executors[1].framework_id());
+  EXPECT_SOME(master::validation::master::message::reregisterSlave(
+      slaveInfo, tasks, resources, executors, frameworks));
+}
+
 } // namespace tests {
 } // namespace internal {
 } // namespace mesos {


[3/3] mesos git commit: Added MESOS-8169 to the 1.4.1 CHANGELOG.

Posted by jp...@apache.org.
Added MESOS-8169 to the 1.4.1 CHANGELOG.


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

Branch: refs/heads/1.4.x
Commit: b0448a4b5598d93cbb071706e7dbea1a802e66d9
Parents: b6022a1
Author: James Peach <jp...@apache.org>
Authored: Wed Nov 8 08:55:09 2017 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Nov 8 08:55:09 2017 -0800

----------------------------------------------------------------------
 CHANGELOG | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b0448a4b/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 5f79455..40e05e2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,7 +4,7 @@ This release contains the following new features:
 
 All Resolved Issues:
 
-**Bug
+** Bug
  * [MESOS-7873] - Expose `ExecutorInfo.ContainerInfo.NetworkInfo` in Mesos `state` endpoint.
  * [MESOS-7921] - ProcessManager::resume sometimes crashes accessing EventQueue.
  * [MESOS-7964] - Heavy-duty GC makes the agent unresponsive.
@@ -14,6 +14,7 @@ All Resolved Issues:
  * [MESOS-8051] - Killing TASK_GROUP fail to kill some tasks.
  * [MESOS-8080] - The default executor does not propagate missing task exit status correctly.
  * [MESOS-8135] - Masters can lose track of tasks' executor IDs.
+ * [MESOS-8169] - Incorrect master validation forces executor IDs to be globally unique.
 
 
 Release Notes - Mesos - Version 1.4.0


[2/3] mesos git commit: Fixed incorrect validation that forced ExecutorID uniqueness.

Posted by jp...@apache.org.
Fixed incorrect validation that forced ExecutorID uniqueness.

In the ReregisterSlaveMessage message validation, we were
requiring the ExecutorID to be unique across a whole agent.
In fact, only the {FrameworkID, ExecutorID} tuple must be
unique.

This closes #248


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

Branch: refs/heads/1.4.x
Commit: ed1f00e356a782892d20b31905fe45f775082710
Parents: a2b346b
Author: James DeFelice <ja...@gmail.com>
Authored: Mon Nov 6 16:53:41 2017 -0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Nov 8 08:25:21 2017 -0800

----------------------------------------------------------------------
 src/master/validation.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ed1f00e3/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index 279dd51..d029520 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -44,6 +44,7 @@
 
 using process::http::authentication::Principal;
 
+using std::pair;
 using std::set;
 using std::string;
 using std::vector;
@@ -284,7 +285,7 @@ Option<Error> reregisterSlave(
     const vector<FrameworkInfo>& frameworkInfos)
 {
   hashset<FrameworkID> frameworkIDs;
-  hashset<ExecutorID> executorIDs;
+  hashset<pair<FrameworkID, ExecutorID>> executorIDs;
 
   Option<Error> error = validateSlaveInfo(slaveInfo);
   if (error.isSome()) {
@@ -336,12 +337,14 @@ Option<Error> reregisterSlave(
     }
 
     if (executor.has_executor_id()) {
-      if (executorIDs.contains(executor.executor_id())) {
-        return Error("Executor has a duplicate ExecutorID '" +
+      auto id = std::make_pair(executor.framework_id(), executor.executor_id());
+      if (executorIDs.contains(id)) {
+        return Error("Framework '" + stringify(executor.framework_id()) +
+                     "' has a duplicate ExecutorID '" +
                      stringify(executor.executor_id()) + "'");
       }
 
-      executorIDs.insert(executor.executor_id());
+      executorIDs.insert(id);
     }
   }
 
@@ -365,7 +368,8 @@ Option<Error> reregisterSlave(
     // is generated on the agent (see Slave::doReliableRegistration). Only
     // running tasks ought to have executors.
     if (task.has_executor_id() && task.state() == TASK_RUNNING) {
-      if (!executorIDs.contains(task.executor_id())) {
+      auto id = std::make_pair(task.framework_id(), task.executor_id());
+      if (!executorIDs.contains(id)) {
         return Error("Task has an invalid ExecutorID '" +
                      stringify(task.executor_id()) + "'");
       }