You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/11/04 02:29:26 UTC

svn commit: r1405458 - /incubator/mesos/branches/0.10.0/src/detector/detector.cpp

Author: benh
Date: Sun Nov  4 01:29:25 2012
New Revision: 1405458

URL: http://svn.apache.org/viewvc?rev=1405458&view=rev
Log:
Fixed bug in the master detector where a contending master (who is not
the leader yet) might fail to recognize it is now the leader
(https://reviews.apache.org/r/7289).

Modified:
    incubator/mesos/branches/0.10.0/src/detector/detector.cpp

Modified: incubator/mesos/branches/0.10.0/src/detector/detector.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.0/src/detector/detector.cpp?rev=1405458&r1=1405457&r2=1405458&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.0/src/detector/detector.cpp (original)
+++ incubator/mesos/branches/0.10.0/src/detector/detector.cpp Sun Nov  4 01:29:25 2012
@@ -371,33 +371,12 @@ void ZooKeeperMasterDetector::reconnecte
 {
   LOG(INFO) << "Master detector reconnected ...";
 
-  int code;
-  string result;
-
-  static const string delimiter = "/";
-
-  if (contend) {
-    // Contending for master, confirm our ephemeral sequence znode exists.
-    code = zk->get(url.path + "/" + mySeq, false, &result, NULL);
-
-    // We might no longer be the master! Commit suicide for now
-    // (hoping another master is on standbye), but in the future
-    // it would be nice if we could go back on standbye.
-    if (code == ZNONODE) {
-      LOG(FATAL) << "Failed to reconnect to ZooKeeper quickly enough "
-        "(our ephemeral sequence znode is gone), commiting suicide!";
-    }
-
-    if (code != ZOK) {
-      LOG(FATAL) << "Unexpected ZooKeeper error: " << zk->message(code);
-    }
-
-    // We are still the master!
-    LOG(INFO) << "Still acting as master";
-  } else {
-    // Reconnected, but maybe the master changed?
-    detectMaster();
-  }
+  // Either we were the master and we're still the master (because we
+  // haven't yet gotten a session expiration), or someone else was the
+  // master and they're still the master, or someone else was the
+  // master and someone else still is now the master. Either way, run
+  // the leader detector.
+  detectMaster();
 }