You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2013/10/08 20:28:43 UTC
[2/2] git commit: Fixed a case where Framework re-registration time
was not being updated.
Fixed a case where Framework re-registration time was not being
updated.
Also refactored the time into an Option.
Review: https://reviews.apache.org/r/13744
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fb2a47a6
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fb2a47a6
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fb2a47a6
Branch: refs/heads/master
Commit: fb2a47a6b22d9601ad10b451ad5adc37300aceb0
Parents: 5764485
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Thu Aug 22 10:53:32 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Tue Oct 8 11:11:31 2013 -0700
----------------------------------------------------------------------
src/master/master.cpp | 18 +++++++++++-------
src/master/master.hpp | 4 ++++
2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/fb2a47a6/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index ce8365f..8e6a6ea 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -743,6 +743,7 @@ void Master::reregisterFramework(const FrameworkInfo& frameworkInfo,
// know which scheduler is the correct one.
Framework* framework = frameworks[frameworkInfo.id()];
+ framework->reregisteredTime = Clock::now();
if (failover) {
// TODO: Should we check whether the new scheduler has given
@@ -777,6 +778,7 @@ void Master::reregisterFramework(const FrameworkInfo& frameworkInfo,
// any tasks it has that have been reported by reconnecting slaves.
Framework* framework =
new Framework(frameworkInfo, frameworkInfo.id(), from, Clock::now());
+ framework->reregisteredTime = Clock::now();
// TODO(benh): Check for root submissions like above!
@@ -1372,11 +1374,15 @@ void Master::frameworkFailoverTimeout(const FrameworkID& frameworkId,
const Time& reregisteredTime)
{
Framework* framework = getFramework(frameworkId);
- if (framework != NULL && !framework->active &&
- framework->reregisteredTime == reregisteredTime) {
- LOG(INFO) << "Framework failover timeout, removing framework "
- << framework->id;
- removeFramework(framework);
+
+ if (framework != NULL && !framework->active) {
+ // If the re-registration time has not changed, then the framework
+ // has not re-registered within the failover timeout.
+ if (framework->reregisteredTime == reregisteredTime) {
+ LOG(INFO) << "Framework failover timeout, removing framework "
+ << framework->id;
+ removeFramework(framework);
+ }
}
}
@@ -2016,8 +2022,6 @@ void Master::failoverFramework(Framework* framework, const UPID& newPid)
allocator->frameworkActivated(framework->id, framework->info);
}
- framework->reregisteredTime = Clock::now();
-
{
FrameworkRegisteredMessage message;
message.mutable_framework_id()->MergeFrom(framework->id);
http://git-wip-us.apache.org/repos/asf/mesos/blob/fb2a47a6/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index 0aeec7f..bed051c 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -114,6 +114,10 @@ public:
const ExecutorID& executorId,
int32_t status);
void deactivateSlave(const SlaveID& slaveId);
+
+ // TODO(bmahler): It would be preferred to use a unique libprocess
+ // Process identifier (PID is not sufficient) for identifying the
+ // framework instance, rather than relying on re-registration time.
void frameworkFailoverTimeout(const FrameworkID& frameworkId,
const Time& reregisteredTime);