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/07 21:43:47 UTC

mesos git commit: Fixed incorrect validation that forced ExecutorID uniqueness.

Repository: mesos
Updated Branches:
  refs/heads/master f5e1c928b -> 76fcf0e6d


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/76fcf0e6
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/76fcf0e6
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/76fcf0e6

Branch: refs/heads/master
Commit: 76fcf0e6d2160bec29f6966c400c57ffb8e64bda
Parents: f5e1c92
Author: James DeFelice <ja...@gmail.com>
Authored: Mon Nov 6 16:53:41 2017 -0800
Committer: James Peach <jp...@apache.org>
Committed: Tue Nov 7 11:17:57 2017 -0800

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/76fcf0e6/src/master/validation.cpp
----------------------------------------------------------------------
diff --git a/src/master/validation.cpp b/src/master/validation.cpp
index b8db1ce..55aac2f 100644
--- a/src/master/validation.cpp
+++ b/src/master/validation.cpp
@@ -46,6 +46,7 @@
 
 using process::http::authentication::Principal;
 
+using std::pair;
 using std::set;
 using std::string;
 using std::vector;
@@ -298,7 +299,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()) {
@@ -350,12 +351,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);
     }
   }
 
@@ -379,7 +382,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()) + "'");
       }