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 2011/06/05 08:38:00 UTC

svn commit: r1131931 - /incubator/mesos/trunk/src/master_detector.cpp

Author: benh
Date: Sun Jun  5 06:38:00 2011
New Revision: 1131931

URL: http://svn.apache.org/viewvc?rev=1131931&view=rev
Log:
Bug fix in ZooKeeper master detector implementation.

Modified:
    incubator/mesos/trunk/src/master_detector.cpp

Modified: incubator/mesos/trunk/src/master_detector.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master_detector.cpp?rev=1131931&r1=1131930&r2=1131931&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master_detector.cpp (original)
+++ incubator/mesos/trunk/src/master_detector.cpp Sun Jun  5 06:38:00 2011
@@ -131,8 +131,10 @@ MasterDetector * MasterDetector::create(
       // ZooKeeper, rather than just using it's syntax.
       size_t index = urlPair.second.find("/");
       if (index == string::npos)
-	fatal("expecting chroot path for ZooKeeper string");
+	fatal("expecting chroot path for ZooKeeper");
       const string &znode = urlPair.second.substr(index);
+      if (znode == "/")
+	fatal("expecting chroot path for ZooKeeper ('/' is not supported)");
       const string &servers = urlPair.second.substr(0, index);
       detector = new ZooKeeperMasterDetector(servers, znode, pid, contend, quiet);
       break;
@@ -272,10 +274,6 @@ ZooKeeperMasterDetector::ZooKeeperMaster
   // TODO(benh): Put this in the C++ API.
   zoo_set_debug_level(quiet ? ZOO_LOG_LEVEL_ERROR : ZOO_LOG_LEVEL_DEBUG);
 
-  // TODO(benh): Don't deal with znode like this!
-  if (znode == "/")
-    znode = "";
-
   // Start up the ZooKeeper connection!
   zk = new ZooKeeper(servers, 10000, this);
 }
@@ -321,7 +319,7 @@ void ZooKeeperMasterDetector::process(Zo
       }
 
       // Wierdness in ZooKeeper timing, let's check that everything is created.
-      ret = zk->get(znode + "/", false, &result, NULL);
+      ret = zk->get(znode, false, &result, NULL);
 
       if (ret != ZOK)
 	fatal("ZooKeeper not responding correctly (%s). "