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 07:35:09 UTC

svn commit: r1131802 - in /incubator/mesos/trunk/src: config.hpp.in master_detector.cpp master_main.cpp

Author: benh
Date: Sun Jun  5 05:35:08 2011
New Revision: 1131802

URL: http://svn.apache.org/viewvc?rev=1131802&view=rev
Log:
Removing need for compile time configured znode for ZooKeeper.

Modified:
    incubator/mesos/trunk/src/config.hpp.in
    incubator/mesos/trunk/src/master_detector.cpp
    incubator/mesos/trunk/src/master_main.cpp

Modified: incubator/mesos/trunk/src/config.hpp.in
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/config.hpp.in?rev=1131802&r1=1131801&r2=1131802&view=diff
==============================================================================
--- incubator/mesos/trunk/src/config.hpp.in (original)
+++ incubator/mesos/trunk/src/config.hpp.in Sun Jun  5 05:35:08 2011
@@ -5,9 +5,6 @@
 
 #include <string>
 
-/* Constants. */
-const std::string ZNODE = "/usr/benh/nexus";
-
 #if @WITH_WEBUI@
   #define NEXUS_WEBUI
 #endif

Modified: incubator/mesos/trunk/src/master_detector.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master_detector.cpp?rev=1131802&r1=1131801&r2=1131802&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master_detector.cpp (original)
+++ incubator/mesos/trunk/src/master_detector.cpp Sun Jun  5 05:35:08 2011
@@ -127,8 +127,14 @@ MasterDetector * MasterDetector::create(
   switch (urlPair.first) {
     // ZooKeeper URL.
     case UrlProcessor::ZOO: {
-      const string &servers = urlPair.second;
-      detector = new ZooKeeperMasterDetector(servers, ZNODE, pid, contend, quiet);
+      // TODO(benh): Consider actually using the chroot feature of
+      // 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");
+      const string &znode = urlPair.second.substr(index);
+      const string &servers = urlPair.second.substr(0, index);
+      detector = new ZooKeeperMasterDetector(servers, znode, pid, contend, quiet);
       break;
     }
 
@@ -292,7 +298,7 @@ void ZooKeeperMasterDetector::process(Zo
     // Check if this is a reconnect.
     if (!reconnect) {
       // Assume the znode that was created does not end with a "/".
-      CHECK(znode.at(znode.length() - 1) != '/');
+      CHECK(znode.at(znode.length() - 1) != '/' || znode.length() == 1);
 
       // Create directory path znodes as necessary.
       size_t index = znode.find(delimiter, 0);

Modified: incubator/mesos/trunk/src/master_main.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/master_main.cpp?rev=1131802&r1=1131801&r2=1131802&view=diff
==============================================================================
--- incubator/mesos/trunk/src/master_main.cpp (original)
+++ incubator/mesos/trunk/src/master_main.cpp Sun Jun  5 05:35:08 2011
@@ -41,7 +41,6 @@ int main (int argc, char **argv)
 
   string url = "";
   string allocator = "simple";
-  string znode = ZNODE;
   bool quiet = false;
 
   int opt;