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

mesos git commit: Fixed duplicate framework ids in "unregistered_frameworks".

Repository: mesos
Updated Branches:
  refs/heads/master 25e00546d -> 9108822e5


Fixed duplicate framework ids in "unregistered_frameworks".

The existing test (MasterTest.OrphanTasks) continues to pass after
the change. I will try to write another test that spawns multiple
agents to ensure the duplicate framework ids are not shown.

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


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

Branch: refs/heads/master
Commit: 9108822e55a15e0ecd8f6ab231c007af14eb2b28
Parents: 25e0054
Author: Vinod Kone <vi...@gmail.com>
Authored: Mon Oct 24 17:05:12 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Fri Oct 28 13:48:28 2016 -0700

----------------------------------------------------------------------
 src/master/http.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9108822e/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 716077a..2f275f6 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -1343,13 +1343,18 @@ Future<Response> Master::Http::frameworks(
 
         // Model all currently unregistered frameworks. This can happen
         // when a framework has yet to re-register after master failover.
+        // TODO(vinod): Need to filter these frameworks based on authorization!
+        // See TODO in `state()` for further details.
         writer->field("unregistered_frameworks", [this](
             JSON::ArrayWriter* writer) {
           // Find unregistered frameworks.
+          hashset<FrameworkID> frameworkIds;
           foreachvalue (const Slave* slave, master->slaves.registered) {
             foreachkey (const FrameworkID& frameworkId, slave->tasks) {
-              if (!master->frameworks.registered.contains(frameworkId)) {
+              if (!master->frameworks.registered.contains(frameworkId) &&
+                  !frameworkIds.contains(frameworkId)) {
                 writer->element(frameworkId.value());
+                frameworkIds.insert(frameworkId);
               }
             }
           }
@@ -2743,10 +2748,13 @@ Future<Response> Master::Http::state(
         writer->field("unregistered_frameworks", [this](
             JSON::ArrayWriter* writer) {
           // Find unregistered frameworks.
+          hashset<FrameworkID> frameworkIds;
           foreachvalue (const Slave* slave, master->slaves.registered) {
             foreachkey (const FrameworkID& frameworkId, slave->tasks) {
-              if (!master->frameworks.registered.contains(frameworkId)) {
+              if (!master->frameworks.registered.contains(frameworkId) &&
+                  !frameworkIds.contains(frameworkId)) {
                 writer->element(frameworkId.value());
+                frameworkIds.insert(frameworkId);
               }
             }
           }