You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2017/11/13 20:45:49 UTC

[1/3] mesos git commit: Allowed multiple master detections in MasterFailover test.

Repository: mesos
Updated Branches:
  refs/heads/master 1c94458e3 -> 7955dc9dc


Allowed multiple master detections in MasterFailover test.

After master failover, the scheduler library can fire new master
detection more than once. We are not interested in sporadic
connected events, but in the end result: the scheduler can
resubscribe with the same framework id.

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


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

Branch: refs/heads/master
Commit: ebd27f8a39177ef26d05bbde5ad0e2e66c8811ff
Parents: a6bb16a
Author: Alexander Rukletsov <al...@apache.org>
Authored: Tue Nov 7 21:24:16 2017 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Nov 13 21:41:47 2017 +0100

----------------------------------------------------------------------
 src/tests/scheduler_tests.cpp | 58 +++++++++++---------------------------
 1 file changed, 16 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ebd27f8a/src/tests/scheduler_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/scheduler_tests.cpp b/src/tests/scheduler_tests.cpp
index c3ac706..45fc9c0 100644
--- a/src/tests/scheduler_tests.cpp
+++ b/src/tests/scheduler_tests.cpp
@@ -264,37 +264,22 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(SchedulerTest, MasterFailover)
   auto scheduler = std::make_shared<v1::MockHTTPScheduler>();
   auto detector = std::make_shared<StandaloneMasterDetector>(master.get()->pid);
 
-  Future<Nothing> connected;
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected))
-    .WillRepeatedly(Return()); // Ignore future invocations.
-
-  ContentType contentType = GetParam();
-
-  v1::scheduler::TestMesos mesos(
-      master.get()->pid,
-      contentType,
-      scheduler,
-      detector);
-
-  AWAIT_READY(connected);
+    .WillOnce(v1::scheduler::SendSubscribe(v1::DEFAULT_FRAMEWORK_INFO))
+    .WillRepeatedly(Return());
 
   Future<Event::Subscribed> subscribed;
   EXPECT_CALL(*scheduler, subscribed(_, _))
-    .WillOnce(FutureArg<1>(&subscribed));
+    .WillOnce(FutureArg<1>(&subscribed))
+    .WillRepeatedly(Return());
 
   EXPECT_CALL(*scheduler, heartbeat(_))
     .WillRepeatedly(Return()); // Ignore heartbeats.
 
-  {
-    Call call;
-    call.set_type(Call::SUBSCRIBE);
-
-    Call::Subscribe* subscribe = call.mutable_subscribe();
-    subscribe->mutable_framework_info()->CopyFrom(v1::DEFAULT_FRAMEWORK_INFO);
+  ContentType contentType = GetParam();
 
-    mesos.send(call);
-  }
+  v1::scheduler::TestMesos mesos(
+      master.get()->pid, contentType, scheduler, detector);
 
   AWAIT_READY(subscribed);
 
@@ -312,32 +297,21 @@ TEST_P_TEMP_DISABLED_ON_WINDOWS(SchedulerTest, MasterFailover)
 
   AWAIT_READY(disconnected);
 
-  Future<Nothing> connected2;
+  // Scheduler library can fire new master detection more than once.
   EXPECT_CALL(*scheduler, connected(_))
-    .WillOnce(FutureSatisfy(&connected2));
-
-  detector->appoint(master.get()->pid);
-
-  AWAIT_READY(connected2);
+    .WillRepeatedly(
+        v1::scheduler::SendSubscribe(v1::DEFAULT_FRAMEWORK_INFO, frameworkId));
 
+  Future<Event::Subscribed> subscribed2;
   EXPECT_CALL(*scheduler, subscribed(_, _))
-    .WillOnce(FutureArg<1>(&subscribed));
-
-  {
-    Call call;
-    call.mutable_framework_id()->CopyFrom(frameworkId);
-    call.set_type(Call::SUBSCRIBE);
-
-    Call::Subscribe* subscribe = call.mutable_subscribe();
-    subscribe->mutable_framework_info()->CopyFrom(v1::DEFAULT_FRAMEWORK_INFO);
-    subscribe->mutable_framework_info()->mutable_id()->CopyFrom(frameworkId);
+    .WillOnce(FutureArg<1>(&subscribed2))
+    .WillRepeatedly(Return());
 
-    mesos.send(call);
-  }
+  detector->appoint(master.get()->pid);
 
-  AWAIT_READY(subscribed);
+  AWAIT_READY(subscribed2);
 
-  EXPECT_EQ(frameworkId, subscribed->framework_id());
+  EXPECT_EQ(frameworkId, subscribed2->framework_id());
 }
 
 


[2/3] mesos git commit: Added a two-parameter SendSubscribe action in test.

Posted by al...@apache.org.
Added a two-parameter SendSubscribe action in test.

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


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

Branch: refs/heads/master
Commit: a6bb16aa431c32962f114fa30527aa2730a7da0d
Parents: 1c94458
Author: Alexander Rukletsov <al...@apache.org>
Authored: Wed Nov 8 17:18:49 2017 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Nov 13 21:41:47 2017 +0100

----------------------------------------------------------------------
 src/tests/mesos.hpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a6bb16aa/src/tests/mesos.hpp
----------------------------------------------------------------------
diff --git a/src/tests/mesos.hpp b/src/tests/mesos.hpp
index 4e2513f..13a4b94 100644
--- a/src/tests/mesos.hpp
+++ b/src/tests/mesos.hpp
@@ -2431,6 +2431,20 @@ ACTION_P(SendSubscribe, frameworkInfo)
   Call call;
   call.set_type(Call::SUBSCRIBE);
   call.mutable_subscribe()->mutable_framework_info()->CopyFrom(frameworkInfo);
+
+  arg0->send(call);
+}
+
+
+ACTION_P2(SendSubscribe, frameworkInfo, frameworkId)
+{
+  Call call;
+  call.set_type(Call::SUBSCRIBE);
+  call.mutable_framework_id()->CopyFrom(frameworkId);
+  call.mutable_subscribe()->mutable_framework_info()->CopyFrom(frameworkInfo);
+  call.mutable_subscribe()->mutable_framework_info()->mutable_id()->CopyFrom(
+      frameworkId);
+
   arg0->send(call);
 }
 


[3/3] mesos git commit: Updated a comment about resubscribing completed frameworks.

Posted by al...@apache.org.
Updated a comment about resubscribing completed frameworks.

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


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

Branch: refs/heads/master
Commit: 7955dc9dc2971055fde684c2e156b6eb18467306
Parents: ebd27f8
Author: Alexander Rukletsov <al...@apache.org>
Authored: Wed Nov 8 11:41:19 2017 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Mon Nov 13 21:44:01 2017 +0100

----------------------------------------------------------------------
 src/master/master.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7955dc9d/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 49dbaa9..59a5339 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -2667,9 +2667,8 @@ void Master::subscribe(
 
   if (validationError.isNone() && frameworkInfo.has_id() &&
       isCompletedFramework(frameworkInfo.id())) {
-    // This could happen if a framework tries to subscribe after its
-    // failover timeout has elapsed or it unregistered itself by
-    // calling 'stop()' on the scheduler driver.
+    // This could happen if a framework tries to subscribe after its failover
+    // timeout has elapsed, or it has been torn down via the opeartor API.
     //
     // TODO(vinod): Master should persist admitted frameworks to the
     // registry and remove them from it after failover timeout.