You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/11/24 12:07:07 UTC

mesos git commit: Made Zk error message more accurate.

Repository: mesos
Updated Branches:
  refs/heads/master f1826a3dd -> 826937e27


Made Zk error message more accurate.

If Zk node creation fails, we should report the full Zk path that we
tried to create. Additionally, `const`-ified all appropriate block-
local variables to maintain local consistency.

Review: https://reviews.apache.org/r/53954/


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

Branch: refs/heads/master
Commit: 826937e27f6117f47d9487033547e3d4ff390310
Parents: f1826a3
Author: Neil Conway <ne...@gmail.com>
Authored: Thu Nov 24 12:41:45 2016 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Thu Nov 24 13:06:10 2016 +0100

----------------------------------------------------------------------
 src/zookeeper/group.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/826937e2/src/zookeeper/group.cpp
----------------------------------------------------------------------
diff --git a/src/zookeeper/group.cpp b/src/zookeeper/group.cpp
index 1df4b54..f869cc1 100644
--- a/src/zookeeper/group.cpp
+++ b/src/zookeeper/group.cpp
@@ -599,12 +599,14 @@ Result<Group::Membership> GroupProcess::doJoin(
 {
   CHECK_EQ(state, READY);
 
+  const string path = znode + "/" + (label.isSome() ? (label.get() + "_") : "");
+
   // Create a new ephemeral node to represent a new member and use the
   // the specified data as its contents.
   string result;
 
-  int code = zk->create(
-      znode + "/" + (label.isSome() ? (label.get() + "_") : ""),
+  const int code = zk->create(
+      path,
       data,
       acl,
       ZOO_SEQUENCE | ZOO_EPHEMERAL,
@@ -615,7 +617,7 @@ Result<Group::Membership> GroupProcess::doJoin(
     return None();
   } else if (code != ZOK) {
     return Error(
-        "Failed to create ephemeral node at '" + znode +
+        "Failed to create ephemeral node at '" + path +
         "' in ZooKeeper: " + zk->message(code));
   }
 
@@ -625,10 +627,10 @@ Result<Group::Membership> GroupProcess::doJoin(
 
   // Save the sequence number but only grab the basename. Example:
   // "/path/to/znode/label_0000000131" => "0000000131".
-  string basename = Path(result).basename();
+  const string basename = Path(result).basename();
 
   // Strip the label before grabbing the sequence number.
-  string node = label.isSome()
+  const string node = label.isSome()
       ? strings::remove(basename, label.get() + "_")
       : basename;