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 11:19:20 UTC
svn commit: r1132284 - in /incubator/mesos/trunk/src/detector: detector.cpp
zookeeper.cpp
Author: benh
Date: Sun Jun 5 09:19:20 2011
New Revision: 1132284
URL: http://svn.apache.org/viewvc?rev=1132284&view=rev
Log:
Added some log statements to the detector and fixed a bug in the new libprocess-ified ZooKeeper implementation.
Modified:
incubator/mesos/trunk/src/detector/detector.cpp
incubator/mesos/trunk/src/detector/zookeeper.cpp
Modified: incubator/mesos/trunk/src/detector/detector.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/detector/detector.cpp?rev=1132284&r1=1132283&r2=1132284&view=diff
==============================================================================
--- incubator/mesos/trunk/src/detector/detector.cpp (original)
+++ incubator/mesos/trunk/src/detector/detector.cpp Sun Jun 5 09:19:20 2011
@@ -323,6 +323,8 @@ void ZooKeeperMasterDetector::process(Zo
if ((state == ZOO_CONNECTED_STATE) && (type == ZOO_SESSION_EVENT)) {
// Check if this is a reconnect.
if (!reconnect) {
+ LOG(INFO) << "Connected to ZooKeeper";
+
// Assume the znode that was created does not end with a "/".
CHECK(znode.at(znode.length() - 1) != '/');
@@ -334,22 +336,26 @@ void ZooKeeperMasterDetector::process(Zo
index = znode.find(delimiter, index + 1);
string prefix = znode.substr(0, index);
+ LOG(INFO) << "Trying to create znode '" << prefix << "' in ZooKeeper";
+
// Create the node (even if it already exists).
ret = zk->create(prefix, "", ZOO_OPEN_ACL_UNSAFE,
// ZOO_CREATOR_ALL_ACL, // needs authentication
0, &result);
- if (ret != ZOK && ret != ZNODEEXISTS)
+ if (ret != ZOK && ret != ZNODEEXISTS) {
fatal("failed to create ZooKeeper znode! (%s)", zk->error(ret));
+ }
}
// Wierdness in ZooKeeper timing, let's check that everything is created.
ret = zk->get(znode, false, &result, NULL);
- if (ret != ZOK)
+ if (ret != ZOK) {
fatal("ZooKeeper not responding correctly (%s). "
"Make sure ZooKeeper is running on: %s",
zk->error(ret), servers.c_str());
+ }
if (contend) {
// We contend with the pid given in constructor.
@@ -357,10 +363,11 @@ void ZooKeeperMasterDetector::process(Zo
// ZOO_CREATOR_ALL_ACL, // needs authentication
ZOO_SEQUENCE | ZOO_EPHEMERAL, &result);
- if (ret != ZOK)
+ if (ret != ZOK) {
fatal("ZooKeeper not responding correctly (%s). "
"Make sure ZooKeeper is running on: %s",
zk->error(ret), servers.c_str());
+ }
setId(result);
LOG(INFO) << "Created ephemeral/sequence:" << getId();
Modified: incubator/mesos/trunk/src/detector/zookeeper.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/detector/zookeeper.cpp?rev=1132284&r1=1132283&r2=1132284&view=diff
==============================================================================
--- incubator/mesos/trunk/src/detector/zookeeper.cpp (original)
+++ incubator/mesos/trunk/src/detector/zookeeper.cpp Sun Jun 5 09:19:20 2011
@@ -57,9 +57,9 @@ WatcherProcessManager* manager;
class WatcherProcess : public Process<WatcherProcess>
{
public:
- WatcherProcess(Watcher *_watcher) : watcher(_watcher) {}
+ WatcherProcess(Watcher* _watcher) : watcher(_watcher) {}
- void event(ZooKeeper *zk, int type, int state, const char *path)
+ void event(ZooKeeper* zk, int type, int state, const string& path)
{
watcher->process(zk, type, state, path);
}
@@ -315,11 +315,11 @@ protected:
// Okay, a message must have been received. Handle only one
// message at a time so as not to delay any necessary internal
// processing.
- serve(0, false);
+ serve(0, true);
if (name() == process::TERMINATE) {
return;
- } else {
- fatal("unexpected interruption during await");
+ } else if (name() != process::NOTHING) {
+ fatal("unexpected interruption of 'poll'");
}
}
}