Updated Branches:
  refs/heads/master e769b3b77 -> caa3c301f

Fixed a bug that can cause the Master to produce a growing number of
leader detection loops.

From: Jiang Yan Xu <y...@jxu.me>
Review: https://reviews.apache.org/r/16333


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

Branch: refs/heads/master
Commit: caa3c301f2839e388ffc2faa2d255a8af31ed37b
Parents: e769b3b
Author: Benjamin Mahler <bmah...@twitter.com>
Authored: Thu Dec 19 12:13:29 2013 -0800
Committer: Benjamin Mahler <bmah...@twitter.com>
Committed: Thu Dec 19 12:13:29 2013 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/caa3c301/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index dd61119..30cea54 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -545,9 +545,12 @@ void Master::initialize()
 
   contender->initialize(self());
 
-  // Start contending to be a leading master.
+  // Start contending to be a leading master and detecting the current
+  // leader.
   contender->contend()
     .onAny(defer(self(), &Master::contended, lambda::_1));
+  detector->detect()
+    .onAny(defer(self(), &Master::detected, lambda::_1));
 }
 
 
@@ -696,11 +699,6 @@ void Master::contended(const Future<Future<Nothing> >& 
_contended)
   CHECK(_contended.isReady()) <<
     "Not expecting MasterContender to discard this future";
 
-  // Now that we know we have our candidacy registered, we start
-  // detecting who is the leader.
-  detector->detect()
-    .onAny(defer(self(), &Master::detected, lambda::_1));
-
   // Watch for candidacy change.
   _contended.get()
     .onAny(defer(self(), &Master::lostCandidacy, lambda::_1));

Reply via email to